瀏覽代碼

Merge pull request #4622 from ghalliday/issue9667

HPCC-9667 Don't use buildTempExpr for getresults (can clone rows)

Reviewed-By: Richard Chapman <rchapman@hpccsystems.com>
Richard Chapman 12 年之前
父節點
當前提交
ca55cb0e21
共有 1 個文件被更改,包括 16 次插入12 次删除
  1. 16 12
      ecl/hqlcpp/hqlcpp.cpp

+ 16 - 12
ecl/hqlcpp/hqlcpp.cpp

@@ -4406,28 +4406,32 @@ void HqlCppTranslator::doBuildExprAlias(BuildCtx & ctx, IHqlExpression * expr, C
     while (value->getOperator() == no_alias)
         value = value->queryChild(0);
 
+    CHqlBoundExpr bound;
+    if (!tgt)
+        tgt = &bound;
+
     //The second half of this test could cause aliases to be duplicated, but has the significant effect of reducing the amount of data that is serialised.
     //so far on my examples it does the latter, but doesn't seem to cause the former
     if (expr->hasAttribute(localAtom) || (insideOnCreate(ctx) && !expr->hasAttribute(globalAtom)))
     {
         expandAliases(ctx, value);
-        if (tgt)
-            buildTempExpr(ctx, value, *tgt);
-        else
+
+        switch (value->getOperator())
         {
-            CHqlBoundExpr bound;
-            buildTempExpr(ctx, value, bound);
+        // these operations generate temporaries anyway, and the row versions are inefficient via a buildTempExpr
+        case no_getresult:
+        case no_getgraphresult:
+        case no_getgraphloopresult:
+            buildAnyExpr(ctx, value, *tgt);
+            break;
+        default:
+            buildTempExpr(ctx, value, *tgt);
+            break;
         }
     }
     else
     {
-        if (tgt)
-            doBuildAliasValue(ctx, value, *tgt);
-        else
-        {
-            CHqlBoundExpr bound;
-            doBuildAliasValue(ctx, value, bound);
-        }
+        doBuildAliasValue(ctx, value, *tgt);
     }
 }