浏览代码

Merge pull request #12444 from ghalliday/issue21910

HPCC-21910 Fix core for DATASET(NOFOLD([]), { string txt })

Reviewed-By: Shamser Ahmed <shamser.ahmed@lexisnexis.co.uk>
Reviewed-By: Richard Chapman <rchapman@hpccsystems.com>
Richard Chapman 6 年之前
父节点
当前提交
54dd26f220
共有 3 个文件被更改,包括 37 次插入0 次删除
  1. 3 0
      ecl/hql/hqlgram2.cpp
  2. 1 0
      ecl/hqlcpp/hqlhtcpp.cpp
  3. 33 0
      ecl/regress/nulldataset.ecl

+ 3 - 0
ecl/hql/hqlgram2.cpp

@@ -5805,6 +5805,9 @@ IHqlExpression * HqlGram::createDatasetFromList(attribute & listAttr, attribute
     ITypeInfo * listType = list->queryType();
     assertex(listType);
     ITypeInfo * childType = listType->queryChildType();
+    if (!childType)
+        reportError(ERR_TYPEMISMATCH_RECORD, recordAttr, "Cannot deduce the type of the elements in the set");
+
     IHqlExpression * field = queryOnlyField(record);
     if (!field)
         reportError(ERR_EXPECT_SINGLE_FIELD, recordAttr, "Expected a single field in the dataset parameter");

+ 1 - 0
ecl/hqlcpp/hqlhtcpp.cpp

@@ -4797,6 +4797,7 @@ IHqlExpression * HqlCppTranslator::convertBetweenCountAndSize(const CHqlBoundExp
     case type_array:
         {
             ITypeInfo * elementType = type->queryChildType();
+            assertex(elementType);
             HqlExprArray fields;
             fields.append(*createField(valueId, LINK(elementType), NULL));
             record.setown(createRecord(fields));

+ 33 - 0
ecl/regress/nulldataset.ecl

@@ -0,0 +1,33 @@
+/*##############################################################################
+
+    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.
+############################################################################## */
+
+namesRecord :=
+            RECORD
+string      txt;
+            END;
+
+ds1 := nofold(dataset([],namesRecord));
+output(ds1, named('ds'), extend);
+
+ds2 := dataset(nofold([]),namesRecord);
+output(ds2, named('ds'), extend);
+
+ds3 := DATASET(NOFOLD([]), {string txt});
+output(ds3,named('ds'),extend);
+
+ds4 := dataset(NOFOLD(ALL), {string txt});
+output(ds4, named('ds'), extend);