Преглед на файлове

HPCC-16712 Ensure dataset parameters have correct LCR representation

Signed-off-by: Gavin Halliday <gavin.halliday@lexisnexis.com>
Gavin Halliday преди 7 години
родител
ревизия
1b1ac88170
променени са 3 файла, в които са добавени 74 реда и са изтрити 1 реда
  1. 2 1
      ecl/hqlcpp/hqlcpp.cpp
  2. 57 0
      testing/regress/ecl/issue16712.ecl
  3. 15 0
      testing/regress/ecl/key/issue16712.xml

+ 2 - 1
ecl/hqlcpp/hqlcpp.cpp

@@ -6167,7 +6167,8 @@ void HqlCppTranslator::doBuildCall(BuildCtx & ctx, const CHqlBoundTarget * tgt,
                 if (getBoolAttributeValue(passParamAttr))
                     args.append(*buildMetaParameter(curParam));
                 ExpressionFormat format = queryNaturalFormat(argType);
-                buildDataset(ctx, castParam, bound, format);
+                doBuildDataset(ctx, castParam, bound, format);
+                ensureDatasetFormat(ctx, argType, bound, format);
                 break;
             }
         case type_row:

+ 57 - 0
testing/regress/ecl/issue16712.ecl

@@ -0,0 +1,57 @@
+/*##############################################################################
+
+    HPCC SYSTEMS software Copyright (C) 2018 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=embedded
+//class=python2
+
+IMPORT Python;
+
+nested := RECORD
+  SET OF integer value;
+END;
+
+parent := RECORD
+  DATASET(nested) nest;
+END;
+
+DATASET(parent) getP() := EMBED(C++)
+  __result = rtlMalloc(46);
+  __lenResult = 46;
+  memcpy(__result, "\x2a\x00\x00\x00\x00\x10\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00"
+"\x00\x00\x10\x00\x00\x00\x03\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00", 46);
+ENDEMBED;
+
+unsigned pcode(DATASET(parent) p) := EMBED(Python)
+  count = 0
+  for child in p:
+   for c2 in child.nest:
+     for c3 in c2:
+       for c4 in c3:
+         count += c4
+
+  return count
+ENDEMBED;
+
+ds := getp();
+ds2 := DATASET([{[{[1,2]},{[3,4]}]}], parent);
+sequential(
+    output(ds),
+    output(ds2),
+    pcode(ds);
+    pcode(ds2);
+    ''
+);

+ 15 - 0
testing/regress/ecl/key/issue16712.xml

@@ -0,0 +1,15 @@
+<Dataset name='Result 1'>
+ <Row><nest><Row><value><Item>1</Item><Item>2</Item></value></Row><Row><value><Item>3</Item><Item>4</Item></value></Row></nest></Row>
+</Dataset>
+<Dataset name='Result 2'>
+ <Row><nest><Row><value><Item>1</Item><Item>2</Item></value></Row><Row><value><Item>3</Item><Item>4</Item></value></Row></nest></Row>
+</Dataset>
+<Dataset name='Result 3'>
+ <Row><Result_3>10</Result_3></Row>
+</Dataset>
+<Dataset name='Result 4'>
+ <Row><Result_4>10</Result_4></Row>
+</Dataset>
+<Dataset name='Result 5'>
+ <Row><Result_5></Result_5></Row>
+</Dataset>