瀏覽代碼

HPCC-22692 Spot key field movement

Signed-off-by: Jake Smith <jake.smith@lexisnexisrisk.com>
Jake Smith 5 年之前
父節點
當前提交
6fa02de03e
共有 2 個文件被更改,包括 31 次插入1 次删除
  1. 1 1
      rtl/eclrtl/rtldynfield.cpp
  2. 30 0
      testing/regress/ecl/layouttransbad.ecl

+ 1 - 1
rtl/eclrtl/rtldynfield.cpp

@@ -1560,7 +1560,7 @@ private:
 
                 //Whether this field is in an ifblock, or needs to be copied by linking it do not count as changes
                 FieldMatchType maskedType = (FieldMatchType)(info.matchType & ~(match_link|match_inifblock));
-                if (maskedType != match_perfect && ((field->flags & RFTMispayloadfield) == 0 || (sourceFlags & RFTMispayloadfield) == 0))
+                if (((maskedType != match_perfect) || (idx != info.matchIdx)) && ((field->flags & RFTMispayloadfield) == 0 || (sourceFlags & RFTMispayloadfield) == 0))
                     matchFlags |= match_keychange;
             }
             matchFlags |= info.matchType;

+ 30 - 0
testing/regress/ecl/layouttransbad.ecl

@@ -0,0 +1,30 @@
+/*##############################################################################
+
+    HPCC SYSTEMS software Copyright (C) 2019 HPCC Systems®.
+
+    Licensed under the Apache License, Version 2.0 (the "License");
+    you may not use this file except in compliance with the License.
+    You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+############################################################################## */
+
+//class=file
+//class=index
+//class=error
+//fail
+
+import ^ as root;
+import $.setup;
+Files := setup.Files(false, false, true);
+
+i := INDEX(Files.DG_FlatFile, { DG_lastname, DG_firstname }, { DG_Prange, filepos }, Files.DG_IndexOut+'INDEX');
+o := i(DG_firstname = 'KIMBERLY', DG_LASTNAME='SMITH');
+
+OUTPUT(i);