Selaa lähdekoodia

HPCC-15639 SORT cannot be removed before an aggregate of a COUNT project

Signed-off-by: Gavin Halliday <gavin.halliday@lexisnexis.com>
Gavin Halliday 9 vuotta sitten
vanhempi
commit
da77159849
1 muutettua tiedostoa jossa 6 lisäystä ja 0 poistoa
  1. 6 0
      ecl/hql/hqlopt.cpp

+ 6 - 0
ecl/hql/hqlopt.cpp

@@ -497,6 +497,12 @@ IHqlExpression * CTreeOptimizer::optimizeAggregateUnsharedDataset(IHqlExpression
     case no_fetch:
     case no_transformebcdic:
     case no_transformascii:
+        if (expr->hasAttribute(_countProject_Atom))
+        {
+            //Cannot remove a sort before a count project - because subsequent code may be aggregating or filtering
+            //on fields that contain values derived from the COUNTER
+            return LINK(expr);
+        }
         if (childIsSimpleCount && !isPureActivity(expr))
             childIsSimpleCount = false;
         break;