فهرست منبع

Merge pull request #4104 from ghalliday/issue8665

HPCC-8665 Fix the types of link counted arguments to out of line functions

Reviewed-By: Richard Chapman <rchapman@hpccsystems.com>
Richard Chapman 12 سال پیش
والد
کامیت
d47f71db89
5فایلهای تغییر یافته به همراه49 افزوده شده و 4 حذف شده
  1. 1 0
      ecl/hql/hqlexpr.cpp
  2. 11 2
      ecl/hqlcpp/hqlcpp.cpp
  3. 2 1
      ecl/hqlcpp/hqlttcpp.cpp
  4. 4 1
      ecl/hqlcpp/hqlwcpp.cpp
  5. 31 0
      ecl/regress/outofline1.ecl

+ 1 - 0
ecl/hql/hqlexpr.cpp

@@ -2265,6 +2265,7 @@ inline unsigned doGetNumChildTables(IHqlExpression * dataset)
     case no_parallel:
         return 0;
     case no_quoted:
+    case no_variable:
         return 0;
     case no_mapto:
     case no_compound:

+ 11 - 2
ecl/hqlcpp/hqlcpp.cpp

@@ -3157,6 +3157,7 @@ void HqlCppTranslator::buildExpr(BuildCtx & ctx, IHqlExpression * expr, CHqlBoun
             throwUnexpected();
         buildExpr(ctx, expr->queryChild(0), tgt);
         return;
+    case no_nothor:
     case no_nofold:
     case no_nohoist:
     case no_section:
@@ -11311,8 +11312,16 @@ static IHqlExpression *createActualFromFormal(IHqlExpression *param)
     case type_groupedtable:
         if (paramType->getSize() == UNKNOWN_LENGTH)
         {
-            appendCapital(temp.clear().append("len"), paramNameText);
-            bound.length.setown(createVariable(temp.str(), LINK(sizetType)));
+            if (hasOutOfLineModifier(paramType) || hasLinkCountedModifier(paramType))
+            {
+                appendCapital(temp.clear().append("count"), paramNameText);
+                bound.count.setown(createVariable(temp.str(), LINK(sizetType)));
+            }
+            else
+            {
+                appendCapital(temp.clear().append("len"), paramNameText);
+                bound.length.setown(createVariable(temp.str(), LINK(sizetType)));
+            }
         }
         type.setown(makeReferenceModifier(LINK(type)));
         break;

+ 2 - 1
ecl/hqlcpp/hqlttcpp.cpp

@@ -1197,7 +1197,8 @@ static void normalizeResultFormat(WorkflowArray & workflow, const HqlCppOptions
 {
     ForEachItemIn(idx, workflow)
     {
-        HqlExprArray & exprs = workflow.item(idx).queryExprs();
+        WorkflowItem & cur = workflow.item(idx);
+        HqlExprArray & exprs = cur.queryExprs();
 
         //Until thor has a way of calling a graph and returning a result we need to call this transformer, so that
         //scalars that need to be evaluated in thor are correctly hoisted.

+ 4 - 1
ecl/hqlcpp/hqlwcpp.cpp

@@ -865,7 +865,10 @@ void HqlCppWriter::generateParamCpp(IHqlExpression * param)
     case type_groupedtable:
         if (isConst)
             out.append("const ");
-        out.append("void *");
+        if (hasOutOfLineModifier(paramType) || hasLinkCountedModifier(paramType))
+            out.append("byte * *");
+        else
+            out.append("void *");
         if (isOut)
             out.append(" &");
         break;

+ 31 - 0
ecl/regress/outofline1.ecl

@@ -0,0 +1,31 @@
+/*##############################################################################
+
+    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.
+############################################################################## */
+
+//The following are work arounds until out of line functions are properly implemented
+//There are here just to test the function parameters could be generated correctly
+#option ('hoistSimpleGlobal', false);
+#option ('workunitTemporaries', false);
+
+
+idRec := { unsigned id };
+
+countDataset1(dataset(idRec) x) := DEFINE NOTHOR(COUNT(x(id > 0)));
+countDataset2(linkcounted dataset(idRec) x) := DEFINE NOTHOR(COUNT(x(id > 1)));
+
+x1 := DATASET([1,2,3], idRec);
+output(countDataset1(x1));
+output(countDataset2(x1));