Explorar el Código

Merge pull request #3799 from ghalliday/issue8479

HPCC-8479 Fix invalid C++ generated from sets of integer6.

Reviewed-By: Richard Chapman <rchapman@hpccsystems.com>
Richard Chapman hace 12 años
padre
commit
14be06e160
Se han modificado 2 ficheros con 46 adiciones y 2 borrados
  1. 10 2
      ecl/hqlcpp/hqlcppds.cpp
  2. 36 0
      ecl/regress/addressint.ecl

+ 10 - 2
ecl/hqlcpp/hqlcppds.cpp

@@ -3239,9 +3239,15 @@ BoundRow * HqlCppTranslator::buildDatasetIterateSpecialTempTable(BuildCtx & ctx,
 {
     IHqlExpression * values = expr->queryChild(0);
     bool requiresTempRow = false;
-    ITypeInfo * type = values->queryType()->queryChildType();
+    ITypeInfo * setType = values->queryType();
+    ITypeInfo * type = setType->queryChildType();
     switch (type->getTypeCode())
     {
+    case type_int:
+        requiresTempRow = isComplexSet(setType, false);
+        break;
+    case type_swapint:
+    case type_packedint:
     case type_alien:
     case type_bitfield:
         requiresTempRow = true;
@@ -3256,9 +3262,10 @@ BoundRow * HqlCppTranslator::buildDatasetIterateSpecialTempTable(BuildCtx & ctx,
     CHqlBoundExpr boundCurElement;
     cursor->buildIterateLoop(ctx, boundCurElement, false);
 
-    OwnedHqlExpr address = getPointer(boundCurElement.expr);
     if (requiresTempRow)
     {
+        //MORE: This could probably be improved by having a variety of buildIterateLoop which returned the
+        //underlying bound row.  However it occurs fairly infrequently, so not a priority.
         Owned<BoundRow> tempRow = declareTempAnonRow(ctx, ctx, expr);
         Owned<BoundRow> rowBuilder = createRowBuilder(ctx, tempRow);
 
@@ -3273,6 +3280,7 @@ BoundRow * HqlCppTranslator::buildDatasetIterateSpecialTempTable(BuildCtx & ctx,
     else
     {
         assertex(!boundCurElement.length && !boundCurElement.count);
+        OwnedHqlExpr address = getPointer(boundCurElement.expr);
         address.setown(createValue(no_implicitcast, makeRowReferenceType(expr), LINK(address)));
         return bindTableCursor(ctx, expr, address);
     }

+ 36 - 0
ecl/regress/addressint.ecl

@@ -0,0 +1,36 @@
+/*##############################################################################
+
+    HPCC SYSTEMS software Copyright (C) 2012 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.
+############################################################################## */
+
+set of unsigned6  in_set := [   ] : stored('InputID');
+
+layout := record
+    string20	 	acctno := '';
+    UNSIGNED6 ValID := '';	
+    string1	 ValSrc := '';	
+end;
+
+layout_did := record
+	unsigned6 id:=0;
+end;
+
+
+dsSet := if(exists(in_set),
+            project(dataset(in_set,layout_did),
+                    transform(layout, self.acctno := '1';self.ValId:=left.id;self.ValSRC:='S';self:=[])));
+
+nothor(output(dsSet));
+