Browse Source

HPCC-14294 Correctly transform expressions hoisted inside keyed limits

Signed-off-by: Gavin Halliday <gavin.halliday@lexisnexis.com>
Gavin Halliday 9 years ago
parent
commit
53b9bb1183
2 changed files with 7 additions and 1 deletions
  1. 3 0
      ecl/hqlcpp/hqlhtcpp.cpp
  2. 4 1
      ecl/hqlcpp/hqlttcpp.cpp

+ 3 - 0
ecl/hqlcpp/hqlhtcpp.cpp

@@ -9285,7 +9285,10 @@ IHqlExpression * HqlCppTranslator::optimizeGraphPostResource(IHqlExpression * ex
     LinkedHqlExpr resourced = expr;
     LinkedHqlExpr resourced = expr;
     // Second attempt to spot compound disk reads - this time of spill files for thor.
     // Second attempt to spot compound disk reads - this time of spill files for thor.
     resourced.setown(optimizeCompoundSource(resourced, csfFlags));
     resourced.setown(optimizeCompoundSource(resourced, csfFlags));
+
+    //MORE: This call (enabled by -fparanoid) isn't correct when this is processing a child query
     checkNormalized(resourced);
     checkNormalized(resourced);
+
     //insert projects after compound created...
     //insert projects after compound created...
     if (options.optimizeResourcedProjects)
     if (options.optimizeResourcedProjects)
     {
     {

+ 4 - 1
ecl/hqlcpp/hqlttcpp.cpp

@@ -8054,6 +8054,8 @@ void AutoScopeMigrateTransformer::doAnalyseExpr(IHqlExpression * expr)
     extra->firstUseIsSequential = isSequential;
     extra->firstUseIsSequential = isSequential;
     switch (expr->getOperator())
     switch (expr->getOperator())
     {
     {
+    //Really the child nodes should be visited, and marked to ensure they are never hoisted, implemented
+    //as a prior pass.  However long term this transformation should be removed, so not worth doing now.
     case no_allnodes:
     case no_allnodes:
     case no_keyedlimit:
     case no_keyedlimit:
     case no_nothor:
     case no_nothor:
@@ -8106,7 +8108,6 @@ IHqlExpression * AutoScopeMigrateTransformer::createTransformed(IHqlExpression *
     switch (expr->getOperator())
     switch (expr->getOperator())
     {
     {
     case no_allnodes:
     case no_allnodes:
-    case no_keyedlimit:
     case no_libraryscope:
     case no_libraryscope:
     case no_nothor:
     case no_nothor:
     case no_sequential:
     case no_sequential:
@@ -12665,6 +12666,8 @@ void normalizeHqlTree(HqlCppTranslator & translator, HqlExprArray & exprs)
         translator.noteFinishedTiming("compile:tree transform: normalize.scope", startCycles);
         translator.noteFinishedTiming("compile:tree transform: normalize.scope", startCycles);
     }
     }
 
 
+    translator.checkNormalized(exprs);
+
     if (translator.queryOptions().normalizeLocations)
     if (translator.queryOptions().normalizeLocations)
         normalizeAnnotations(translator, exprs);
         normalizeAnnotations(translator, exprs);