Explorar el Código

HPCC-23286 Stop differences in payload dataset from being treated as keyed

Signed-off-by: Gavin Halliday <gavin.halliday@lexisnexis.com>
Gavin Halliday hace 5 años
padre
commit
f8b7fecab2

+ 3 - 1
rtl/eclrtl/rtldynfield.cpp

@@ -1675,7 +1675,9 @@ private:
                             else if (info.subTrans->canTranslate())
                             {
                                 info.matchType = binarySource ? match_recurse : (match_recurse|match_dynamic);
-                                matchFlags |= info.subTrans->matchFlags;
+                                unsigned childFlags = info.subTrans->matchFlags;
+                                //Ignore differences in the keyed flag for child structures (it will be set later if this field is keyed)
+                                matchFlags |= (FieldMatchType)(childFlags & ~match_keychange);
                             }
                             else
                                 info.matchType = match_fail;

+ 54 - 0
testing/regress/ecl/issue23286.ecl

@@ -0,0 +1,54 @@
+/*##############################################################################
+
+    HPCC SYSTEMS software Copyright (C) 2020 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.
+############################################################################## */
+
+#onwarning(4523, ignore);
+
+import Std.File AS FileServices;
+import $.setup;
+prefix := setup.Files(false, false).QueryFilePrefix;
+
+num := 10;
+pnum := 3;
+
+payloadRec := RECORD
+ UNSIGNED8 p1;
+END;
+rec := RECORD
+ UNSIGNED4 id;
+ DATASET(payloadRec) pl;
+END;
+
+d := DATASET(num, TRANSFORM(rec, SELF.id := COUNTER; SELF.pl := DATASET(pnum, TRANSFORM(payloadRec, SELF.p1 := -COUNTER))));
+
+i := INDEX(d, {id}, {d}, prefix + 'idx');
+
+payloadRec2 := RECORD
+ STRING p1;
+END;
+rec2 := RECORD
+ UNSIGNED4 id;
+ DATASET(payloadRec2) pl;
+END;
+
+d2 := DATASET([], rec2);
+i2 := INDEX(d2, {id}, {d2}, prefix + 'idx');
+
+SEQUENTIAL(
+ OUTPUT(d, , prefix + 'ds', OVERWRITE);
+ BUILDINDEX(i, OVERWRITE);
+ OUTPUT(i2);
+);

+ 16 - 0
testing/regress/ecl/key/issue23286.xml

@@ -0,0 +1,16 @@
+<Dataset name='Result 1'>
+</Dataset>
+<Dataset name='Result 2'>
+</Dataset>
+<Dataset name='Result 3'>
+ <Row><id>1</id><pl><Row><p1>18446744073709551615</p1></Row><Row><p1>18446744073709551614</p1></Row><Row><p1>18446744073709551613</p1></Row></pl><__internal_fpos__>0</__internal_fpos__></Row>
+ <Row><id>2</id><pl><Row><p1>18446744073709551615</p1></Row><Row><p1>18446744073709551614</p1></Row><Row><p1>18446744073709551613</p1></Row></pl><__internal_fpos__>0</__internal_fpos__></Row>
+ <Row><id>3</id><pl><Row><p1>18446744073709551615</p1></Row><Row><p1>18446744073709551614</p1></Row><Row><p1>18446744073709551613</p1></Row></pl><__internal_fpos__>0</__internal_fpos__></Row>
+ <Row><id>4</id><pl><Row><p1>18446744073709551615</p1></Row><Row><p1>18446744073709551614</p1></Row><Row><p1>18446744073709551613</p1></Row></pl><__internal_fpos__>0</__internal_fpos__></Row>
+ <Row><id>5</id><pl><Row><p1>18446744073709551615</p1></Row><Row><p1>18446744073709551614</p1></Row><Row><p1>18446744073709551613</p1></Row></pl><__internal_fpos__>0</__internal_fpos__></Row>
+ <Row><id>6</id><pl><Row><p1>18446744073709551615</p1></Row><Row><p1>18446744073709551614</p1></Row><Row><p1>18446744073709551613</p1></Row></pl><__internal_fpos__>0</__internal_fpos__></Row>
+ <Row><id>7</id><pl><Row><p1>18446744073709551615</p1></Row><Row><p1>18446744073709551614</p1></Row><Row><p1>18446744073709551613</p1></Row></pl><__internal_fpos__>0</__internal_fpos__></Row>
+ <Row><id>8</id><pl><Row><p1>18446744073709551615</p1></Row><Row><p1>18446744073709551614</p1></Row><Row><p1>18446744073709551613</p1></Row></pl><__internal_fpos__>0</__internal_fpos__></Row>
+ <Row><id>9</id><pl><Row><p1>18446744073709551615</p1></Row><Row><p1>18446744073709551614</p1></Row><Row><p1>18446744073709551613</p1></Row></pl><__internal_fpos__>0</__internal_fpos__></Row>
+ <Row><id>10</id><pl><Row><p1>18446744073709551615</p1></Row><Row><p1>18446744073709551614</p1></Row><Row><p1>18446744073709551613</p1></Row></pl><__internal_fpos__>0</__internal_fpos__></Row>
+</Dataset>