浏览代码

Merge pull request #8342 from ghalliday/issue14507

HPCC-14507 Fix problem creating empty dictionaries

Reviewed-By: Jamie Noss <james.noss@lexisnexis.com>
Reviewed-By: Richard Chapman <rchapman@hpccsystems.com>
Richard Chapman 9 年之前
父节点
当前提交
9996de613b
共有 2 个文件被更改,包括 21 次插入2 次删除
  1. 12 2
      ecl/hqlcpp/hqlhtcpp.cpp
  2. 9 0
      ecl/regress/issue14507.ecl

+ 12 - 2
ecl/hqlcpp/hqlhtcpp.cpp

@@ -11285,8 +11285,18 @@ ABoundActivity * HqlCppTranslator::doBuildActivityDictionaryWorkunitWrite(BuildC
     IHqlExpression * name = queryResultName(expr);
     int sequence = (int)getIntValue(seq, ResultSequenceInternal);
 
-    assertex(dictionary->getOperator() == no_createdictionary);
-    IHqlExpression * dataset = dictionary->queryChild(0);
+    OwnedHqlExpr dataset;
+    switch (dictionary->getOperator())
+    {
+    case no_null:
+        dataset.setown(createNullDataset(dictionary));
+        break;
+    case no_createdictionary:
+        dataset.set(dictionary->queryChild(0));
+        break;
+    default:
+        throwUnexpectedOp(dictionary->getOperator());
+    }
 
     Owned<ABoundActivity> boundDataset = buildCachedActivity(ctx, dataset);
 

+ 9 - 0
ecl/regress/issue14507.ecl

@@ -0,0 +1,9 @@
+RCCodes(STRING5 Code) := MODULE
+EXPORT Dct := DICTIONARY([
+        ],{ STRING5 Code => STRING GroupType, STRING Description }) : ONCE;
+EXPORT GroupType := Dct[Code].GroupType;
+EXPORT Description := Dct[Code].Description;
+END;
+
+Description := RCCodes('23456').Description;
+output (Description);