Browse Source

HPCC-11844 Fix inconsistency generated in expression tree

Signed-off-by: Gavin Halliday <gavin.halliday@lexisnexis.com>
Gavin Halliday 11 năm trước cách đây
mục cha
commit
ba413c913f
2 tập tin đã thay đổi với 6 bổ sung2 xóa
  1. 2 2
      ecl/hqlcpp/hqlttcpp.cpp
  2. 4 0
      ecl/hqlcpp/hqlttcpp.ipp

+ 2 - 2
ecl/hqlcpp/hqlttcpp.cpp

@@ -12479,12 +12479,12 @@ IHqlExpression * HqlTreeNormalizer::createTransformedBody(IHqlExpression * expr)
                     OwnedHqlExpr mappedFilter = replaceSelector(filter, left, dataset);
                     initialLoopDataset.setown(createDataset(no_filter, initialLoopDataset.getClear(), LINK(mappedFilter)));
                 }
-                OwnedHqlExpr firstCond = replaceExpression(loopCond, rowsExpr, initialLoopDataset);
+                OwnedHqlExpr firstCond = quickFullReplaceExpression(loopCond, rowsExpr, initialLoopDataset);
                 if (counter)
                 {
                     //Whether to evaluate the 1st time round the loop requires COUNTER=1
                     OwnedHqlExpr one = createConstant(createIntValue(1, counter->getType()));
-                    firstCond.setown(replaceExpression(firstCond, counter, one));
+                    firstCond.setown(quickFullReplaceExpression(firstCond, counter, one));
                 }
                 return appendOwnedOperand(transformed, createExprAttribute(_loopFirst_Atom, firstCond.getClear()));
             }

+ 4 - 0
ecl/hqlcpp/hqlttcpp.ipp

@@ -1201,6 +1201,10 @@ protected:
         return LINK(expr);
     }
 
+//Try and prevent this being called by accident - need to call quickFullReplaceExpression() instead
+//because the tree isn't normalized at this point
+    void replaceExpression(IHqlExpression * expr, IHqlExpression * original, IHqlExpression * replacement);
+
 protected:
     HqlCppTranslator & translator;
     IErrorReceiver * errors;