Ver código fonte

Merge pull request #4671 from ghalliday/issue9759

HPCC-9759 Remove the globalFold option (default always on)

Reviewed-By: Richard Chapman <rchapman@hpccsystems.com>
Richard Chapman 12 anos atrás
pai
commit
3e54e2170e

+ 2 - 9
ecl/hqlcpp/hqlcpp.cpp

@@ -1594,7 +1594,6 @@ void HqlCppTranslator::cacheOptions()
         DebugOption(options.alwaysAllowAllNodes,"alwaysAllowAllNodes", false),
         DebugOption(options.slidingJoins,"slidingJoins", false),
         DebugOption(options.foldOptimized,"foldOptimized", false),
-        DebugOption(options.globalFold,"globalFold", true),
         DebugOption(options.globalOptimize,"globalOptimize", false),
         DebugOption(options.applyInstantEclTransformations,"applyInstantEclTransformations", false),        // testing option
         DebugOption(options.calculateComplexity,"calculateComplexity", false),
@@ -1769,12 +1768,6 @@ void HqlCppTranslator::cacheOptions()
 
     options.inlineStringThreshold = wu()->getDebugValueInt("inlineStringThreshold", (options.targetCompiler != Vs6CppCompiler) ? 0 : 10000);
 
-    if (!options.globalFold)
-    {
-        options.constantFoldNormalize = false;
-        options.constantFoldPostNormalize = false;
-    }
-
     options.implicitLinkedChildRows = true;
     options.finalizeAllRows = true;     // inline temporary rows should actually be ok.
 
@@ -2315,7 +2308,7 @@ void HqlCppTranslator::buildExprAssign(BuildCtx & ctx, const CHqlBoundTarget & t
     case no_notin:
         {
             OwnedHqlExpr optimized = querySimplifyInExpr(expr);
-            if (options.globalFold && optimized)
+            if (optimized)
             {
                 OwnedHqlExpr folded = foldHqlExpression(optimized);
                 buildExprAssign(ctx, target, folded);
@@ -3044,7 +3037,7 @@ void HqlCppTranslator::buildExpr(BuildCtx & ctx, IHqlExpression * expr, CHqlBoun
             else
             {
                 OwnedHqlExpr optimized = querySimplifyInExpr(expr);
-                if (options.globalFold && optimized)
+                if (optimized)
                 {
                     OwnedHqlExpr folded = foldHqlExpression(optimized);
                     buildExpr(ctx, folded, tgt);

+ 1 - 2
ecl/hqlcpp/hqlcpp.hpp

@@ -35,8 +35,7 @@ The following debug options are currently supported by the code generator:
 "expandRepeatAnyAsDfa"   true   - is ANY* expanded in a DFA
 "forceFakeThor"          false  - force code to use hthor.
 "freezePersists"         false  - stop persists being recreated.
-"globalFold"             true   - perform a global constant fold before generating
-    "globalFoldOptions"         - options for above.
+"globalFoldOptions"      0xffff - options for global folding.
 "globalOptimize"         false  - perform a global optimize?
 "groupAllDistribute"     false  - does group,all generate a distribute or a global sort?
 "maximizeLexer"          false  - maximize the amount of work done in the lexer (?default on?)

+ 0 - 1
ecl/hqlcpp/hqlcpp.ipp

@@ -628,7 +628,6 @@ struct HqlCppOptions
     bool                alwaysAllowAllNodes;
     bool                slidingJoins;
     bool                foldOptimized;
-    bool                globalFold;
     bool                globalOptimize;
     bool                applyInstantEclTransformations;
     bool                calculateComplexity;

+ 1 - 2
ecl/hqlcpp/hqlttcpp.cpp

@@ -12627,7 +12627,6 @@ bool HqlCppTranslator::transformGraphForGeneration(HqlQueryContext & query, Work
         DEBUG_TIMER("EclServer: tree transform: substituteClusterSize", msTick()-startTime);
     }
 
-    if (options.globalFold)
     {
         unsigned startTime = msTick();
         HqlExprArray folded;
@@ -12649,7 +12648,7 @@ bool HqlCppTranslator::transformGraphForGeneration(HqlQueryContext & query, Work
     {
         unsigned startTime = msTick();
         HqlExprArray folded;
-        optimizeHqlExpression(folded, exprs, options.globalFold ? HOOfold : 0);
+        optimizeHqlExpression(folded, exprs, HOOfold);
         replaceArray(exprs, folded);
         DEBUG_TIMER("EclServer: tree transform: global optimize", msTick()-startTime);
     }

+ 19 - 19
testing/ecl/regex1.ecl

@@ -38,22 +38,22 @@ filtered := namesTable(REGEXFIND('^(Mc|Mac)', surname));
 
 output(filtered);
 
-output(namesTable, {(string30)REGEXFIND(searchpattern, userdate, 0), '!',
-                    (string30)REGEXFIND(searchpattern, userdate, 1), '!',
-                    (string30)REGEXFIND(searchpattern, userdate, 2), '!',
-                    (string30)REGEXFIND(searchpattern, userdate, 3), '\n'});
-
-REGEXFIND(searchpattern, search, 0);
-REGEXFIND(searchpattern, search, 1);
-REGEXFIND(searchpattern, search, 2);
-REGEXFIND(searchpattern, search, 3);
-
-regexfind('Gavin','Gavin Halliday');
-
-regexfind('GAVIN','Gavin Halliday') AND
-regexfind('GAVIN','Gavin x Halliday') AND 
-regexfind('GAVIN','Gavin Halliday',NOCASE);
-regexfind('GAVIN','Gavin x Halliday') AND regexfind('GAVIN','Gavin x Halliday',1) <> 'x';
-regexfind('GAVIN','Gavin x Halliday',NOCASE) AND regexfind('GAVIN','Gavin x Halliday',1,NOCASE) <> 'x';
-regexfind('GAVIN','Gavin x Halliday') AND regexfind('GAVIN','Gavin x Halliday',1,NOCASE) <> 'x';
-regexfind('GAVIN','Gavin x Halliday',NOCASE) AND regexfind('GAVIN','Gavin x Halliday',1) <> 'x';
+output(namesTable, {(string30)REGEXFIND(NOFOLD(searchpattern), userdate, 0), '!',
+                    (string30)REGEXFIND(NOFOLD(searchpattern), userdate, 1), '!',
+                    (string30)REGEXFIND(NOFOLD(searchpattern), userdate, 2), '!',
+                    (string30)REGEXFIND(NOFOLD(searchpattern), userdate, 3), '\n'});
+
+REGEXFIND(NOFOLD(searchpattern), search, 0);
+REGEXFIND(NOFOLD(searchpattern), search, 1);
+REGEXFIND(NOFOLD(searchpattern), search, 2);
+REGEXFIND(NOFOLD(searchpattern), search, 3);
+
+REGEXFIND(NOFOLD('Gavin'),'Gavin Halliday');
+
+REGEXFIND(NOFOLD('GAVIN'),'Gavin Halliday') AND
+REGEXFIND(NOFOLD('GAVIN'),'Gavin x Halliday') AND
+REGEXFIND(NOFOLD('GAVIN'),'Gavin Halliday',NOCASE);
+REGEXFIND(NOFOLD('GAVIN'),'Gavin x Halliday') AND REGEXFIND(NOFOLD('GAVIN'),'Gavin x Halliday',1) <> 'x';
+REGEXFIND(NOFOLD('GAVIN'),'Gavin x Halliday',NOCASE) AND REGEXFIND(NOFOLD('GAVIN'),'Gavin x Halliday',1,NOCASE) <> 'x';
+REGEXFIND(NOFOLD('GAVIN'),'Gavin x Halliday') AND REGEXFIND(NOFOLD('GAVIN'),'Gavin x Halliday',1,NOCASE) <> 'x';
+REGEXFIND(NOFOLD('GAVIN'),'Gavin x Halliday',NOCASE) AND REGEXFIND(NOFOLD('GAVIN'),'Gavin x Halliday',1) <> 'x';

+ 34 - 34
testing/ecl/regex2.ecl

@@ -16,39 +16,39 @@
 ############################################################################## */
 
 #option ('globalFold', false)
-REGEXFIND('s.t', 'set');
-NOT(REGEXFIND('s.t', 'select'));
-REGEXFIND('s.*t', 'select');
-REGEXFIND('^((..)?(s ?.t)* )+', 'upset sot resets it should match');
-NOT(REGEXFIND('^((..)?(s ?.t)* )+', 'UPSET SOT RESETS IT should match only with NOCASE'));
-REGEXFIND('^((..)?(s ?.t)* )+', 'UPSET SOT RESETS IT should match only with NOCASE', NOCASE);
-REGEXFIND('^((..)?(s ?.t)* )+', 'UPSET SOT RESETS IT should match only with NOCASE', 0, NOCASE) = 'UPSET SOT RESETS IT ';
-REGEXFIND('^((..)?(s ?.t)* )+', 'UPSET SOT RESETS IT should match only with NOCASE', 1, NOCASE) = 'RESETS IT ';
-REGEXFIND('^((..)?(s ?.t)* )+', 'UPSET SOT RESETS IT should match only with NOCASE', 2, NOCASE) = 'RE';
-REGEXFIND('^((..)?(s ?.t)* )+', 'UPSET SOT RESETS IT should match only with NOCASE', 3, NOCASE) = 'S IT';
-REGEXFIND('^((..)?(s ?.t)* )+', 'UPSET SOT RESETS IT should match only with NOCASE', 4, NOCASE) = '';
-REGEXFIND('.ook(?=ahead)', 'lookahead');
-REGEXFIND('.ook(?=ahead)', 'lookahead', 0) = 'look';
-NOT(REGEXFIND('.ook(?=ahead)', 'bookmarks'));
-NOT(REGEXFIND('.ook(?!ahead)', 'lookahead'));
-REGEXFIND('.ook(?!ahead)', 'bookmarks');
-REGEXFIND('.ook(?!ahead)', 'bookmarks', 0) = 'book';
+REGEXFIND(NOFOLD('s.t'), 'set');
+NOT(REGEXFIND(NOFOLD('s.t'), 'select'));
+REGEXFIND(NOFOLD('s.*t'), 'select');
+REGEXFIND(NOFOLD('^((..)?(s ?.t)* )+'), 'upset sot resets it should match');
+NOT(REGEXFIND(NOFOLD('^((..)?(s ?.t)* )+'), 'UPSET SOT RESETS IT should match only with NOCASE'));
+REGEXFIND(NOFOLD('^((..)?(s ?.t)* )+'), 'UPSET SOT RESETS IT should match only with NOCASE', NOCASE);
+REGEXFIND(NOFOLD('^((..)?(s ?.t)* )+'), 'UPSET SOT RESETS IT should match only with NOCASE', 0, NOCASE) = 'UPSET SOT RESETS IT ';
+REGEXFIND(NOFOLD('^((..)?(s ?.t)* )+'), 'UPSET SOT RESETS IT should match only with NOCASE', 1, NOCASE) = 'RESETS IT ';
+REGEXFIND(NOFOLD('^((..)?(s ?.t)* )+'), 'UPSET SOT RESETS IT should match only with NOCASE', 2, NOCASE) = 'RE';
+REGEXFIND(NOFOLD('^((..)?(s ?.t)* )+'), 'UPSET SOT RESETS IT should match only with NOCASE', 3, NOCASE) = 'S IT';
+REGEXFIND(NOFOLD('^((..)?(s ?.t)* )+'), 'UPSET SOT RESETS IT should match only with NOCASE', 4, NOCASE) = '';
+REGEXFIND(NOFOLD('.ook(?=ahead)'), 'lookahead');
+REGEXFIND(NOFOLD('.ook(?=ahead)'), 'lookahead', 0) = 'look';
+NOT(REGEXFIND(NOFOLD('.ook(?=ahead)'), 'bookmarks'));
+NOT(REGEXFIND(NOFOLD('.ook(?!ahead)'), 'lookahead'));
+REGEXFIND(NOFOLD('.ook(?!ahead)'), 'bookmarks');
+REGEXFIND(NOFOLD('.ook(?!ahead)'), 'bookmarks', 0) = 'book';
 
-REGEXFIND(u's.t', u'set');
-NOT(REGEXFIND(u's.t', u'select'));
-REGEXFIND(u's.*t', u'select');
-REGEXFIND(u'^((..)?(s ?.t)* )+', u'upset sot resets it should match');
-NOT(REGEXFIND(u'^((..)?(s ?.t)* )+', u'UPSET SOT RESETS IT should match only with NOCASE'));
-REGEXFIND(u'^((..)?(s ?.t)* )+', u'UPSET SOT RESETS IT should match only with NOCASE', NOCASE);
-REGEXFIND(u'^((..)?(s ?.t)* )+', u'UPSET SOT RESETS IT should match only with NOCASE', 0, NOCASE) = u'UPSET SOT RESETS IT ';
-REGEXFIND(u'^((..)?(s ?.t)* )+', u'UPSET SOT RESETS IT should match only with NOCASE', 1, NOCASE) = u'RESETS IT ';
-REGEXFIND(u'^((..)?(s ?.t)* )+', u'UPSET SOT RESETS IT should match only with NOCASE', 2, NOCASE) = u'RE';
-REGEXFIND(u'^((..)?(s ?.t)* )+', u'UPSET SOT RESETS IT should match only with NOCASE', 3, NOCASE) = u'S IT';
-REGEXFIND(u'^((..)?(s ?.t)* )+', u'UPSET SOT RESETS IT should match only with NOCASE', 4, NOCASE) = u'';
-REGEXFIND(u'.ook(?=ahead)', u'lookahead');
-REGEXFIND(u'.ook(?=ahead)', u'lookahead', 0) = u'look';
-NOT(REGEXFIND(u'.ook(?=ahead)', u'bookmarks'));
-NOT(REGEXFIND(u'.ook(?!ahead)', u'lookahead'));
-REGEXFIND(u'.ook(?!ahead)', u'bookmarks');
-REGEXFIND(u'.ook(?!ahead)', u'bookmarks', 0) = u'book';
+REGEXFIND(NOFOLD(u's.t'), u'set');
+NOT(REGEXFIND(NOFOLD(u's.t'), u'select'));
+REGEXFIND(NOFOLD(u's.*t'), u'select');
+REGEXFIND(NOFOLD(u'^((..)?(s ?.t)* )+'), u'upset sot resets it should match');
+NOT(REGEXFIND(NOFOLD(u'^((..)?(s ?.t)* )+'), u'UPSET SOT RESETS IT should match only with NOCASE'));
+REGEXFIND(NOFOLD(u'^((..)?(s ?.t)* )+'), u'UPSET SOT RESETS IT should match only with NOCASE', NOCASE);
+REGEXFIND(NOFOLD(u'^((..)?(s ?.t)* )+'), u'UPSET SOT RESETS IT should match only with NOCASE', 0, NOCASE) = u'UPSET SOT RESETS IT ';
+REGEXFIND(NOFOLD(u'^((..)?(s ?.t)* )+'), u'UPSET SOT RESETS IT should match only with NOCASE', 1, NOCASE) = u'RESETS IT ';
+REGEXFIND(NOFOLD(u'^((..)?(s ?.t)* )+'), u'UPSET SOT RESETS IT should match only with NOCASE', 2, NOCASE) = u'RE';
+REGEXFIND(NOFOLD(u'^((..)?(s ?.t)* )+'), u'UPSET SOT RESETS IT should match only with NOCASE', 3, NOCASE) = u'S IT';
+REGEXFIND(NOFOLD(u'^((..)?(s ?.t)* )+'), u'UPSET SOT RESETS IT should match only with NOCASE', 4, NOCASE) = u'';
+REGEXFIND(NOFOLD(u'.ook(?=ahead)'), u'lookahead');
+REGEXFIND(NOFOLD(u'.ook(?=ahead)'), u'lookahead', 0) = u'look';
+NOT(REGEXFIND(NOFOLD(u'.ook(?=ahead)'), u'bookmarks'));
+NOT(REGEXFIND(NOFOLD(u'.ook(?!ahead)'), u'lookahead'));
+REGEXFIND(NOFOLD(u'.ook(?!ahead)'), u'bookmarks');
+REGEXFIND(NOFOLD(u'.ook(?!ahead)'), u'bookmarks', 0) = u'book';
 

+ 2 - 2
testing/ecl/regex3.ecl

@@ -17,8 +17,8 @@
 
 #option ('globalFold', false)
 //these should be const-folded, and give 'the cap sap on the map'
-REGEXREPLACE('(.a)t', 'the cat sat on the mat', '$1p');
-REGEXREPLACE(u'(.a)t', u'the cat sat on the mat', u'$1p');
+REGEXREPLACE(NOFOLD('(.a)t'), 'the cat sat on the mat', '$1p');
+REGEXREPLACE(NOFOLD(u'(.a)t'), u'the cat sat on the mat', u'$1p');
 
 inrec := RECORD
     STRING10 str;