Selaa lähdekoodia

Merge pull request #6790 from ghalliday/issue12783

HPCC-12783 Add option to unconditionally optimize no_select(no_createrow)

Reviewed-By: Jamie Noss <james.noss@lexisnexis.com>
Reviewed-By: Richard Chapman <rchapman@hpccsystems.com>
Richard Chapman 10 vuotta sitten
vanhempi
commit
85b6e37d27
4 muutettua tiedostoa jossa 6 lisäystä ja 1 poistoa
  1. 1 1
      ecl/hql/hqlopt.cpp
  2. 1 0
      ecl/hql/hqlopt.hpp
  3. 3 0
      ecl/hqlcpp/hqlcpp.cpp
  4. 1 0
      ecl/hqlcpp/hqlcpp.ipp

+ 1 - 1
ecl/hql/hqlopt.cpp

@@ -2410,7 +2410,7 @@ IHqlExpression * CTreeOptimizer::doCreateTransformed(IHqlExpression * transforme
                             {
                                 //This test should not be required, but it avoids problems with elements from rows
                                 //being used conditionally within transforms.  See HPCC-11018 for details.
-                                if (isIndependentOfScope(match))
+                                if ((options & HOOexpandselectcreaterow) || isIndependentOfScope(match))
                                 {
                                     DBGLOG("Optimizer: Extract value %s from %s", queryNode0Text(cur), queryNode1Text(transformed));
                                     noteUnused(child);

+ 1 - 0
ecl/hql/hqlopt.hpp

@@ -32,6 +32,7 @@ enum
     HOOfoldconstantdatasets     = 0x0080,
     HOOalwayslocal              = 0x0100,
     HOOexpensive                = 0x0200,   // include potentially expensive optimizations
+    HOOexpandselectcreaterow    = 0x0400,
 };
 
 extern HQL_API IHqlExpression * optimizeHqlExpression(IErrorReceiver & errorProcessor, IHqlExpression * expr, unsigned options);

+ 3 - 0
ecl/hqlcpp/hqlcpp.cpp

@@ -1731,6 +1731,7 @@ void HqlCppTranslator::cacheOptions()
         DebugOption(options.reportAssertFilenameTail,"reportAssertFilenameTail",false),        
         DebugOption(options.newBalancedSpotter,"newBalancedSpotter",true),
         DebugOption(options.keyedJoinPreservesOrder,"keyedJoinPreservesOrder",true),
+        DebugOption(options.expandSelectCreateRow,"expandSelectCreateRow",false),
     };
 
     //get options values from workunit
@@ -1863,6 +1864,8 @@ unsigned HqlCppTranslator::getOptimizeFlags() const
         optFlags |= HOOfoldconstantdatasets;
     if (options.optimizeMax)
         optFlags |= HOOexpensive;
+    if (options.expandSelectCreateRow)
+        optFlags  |= HOOexpandselectcreaterow;
     return optFlags;
 }
 

+ 1 - 0
ecl/hqlcpp/hqlcpp.ipp

@@ -736,6 +736,7 @@ struct HqlCppOptions
     bool                reportAssertFilenameTail;
     bool                newBalancedSpotter;
     bool                keyedJoinPreservesOrder;
+    bool                expandSelectCreateRow;
 };
 
 //Any information gathered while processing the query should be moved into here, rather than cluttering up the translator class