Преглед изворни кода

Clean up conditional code

Signed-off-by: Gavin Halliday <gavin.halliday@lexisnexis.com>
Gavin Halliday пре 13 година
родитељ
комит
a6248c27cd
6 измењених фајлова са 8 додато и 20 уклоњено
  1. 1 1
      ecl/hql/hqlexpr.cpp
  2. 4 1
      ecl/hql/hqlexpr.hpp
  3. 0 2
      ecl/hql/hqlpmap.cpp
  4. 0 9
      ecl/hql/hqltrans.cpp
  5. 0 3
      ecl/hqlcpp/hqlresource.cpp
  6. 3 4
      ecl/hqlcpp/hqlttcpp.cpp

+ 1 - 1
ecl/hql/hqlexpr.cpp

@@ -4561,7 +4561,7 @@ inline void addUniqueTable(HqlExprCopyArray & array, IHqlExpression * ds)
 
 inline void addHiddenTable(HqlExprCopyArray & array, IHqlExpression * ds, IHqlExpression * selSeq)
 {
-#if defined(GATHER_HIDDEN_SELECTORS) && !defined(ENSURE_SELSEQ_UID)
+#if defined(GATHER_HIDDEN_SELECTORS)
     if (array.find(*ds) == NotFound)
         array.append(*ds);
 #endif

+ 4 - 1
ecl/hql/hqlexpr.hpp

@@ -28,7 +28,10 @@
 #endif
 
 //#define USE_SELSEQ_UID
-//#define ENSURE_SELSEQ_UID
+//It is impossible to ensure that LEFT/RIGHT are unique, and cannot be nested.  For instance
+//x := PROJECT(ds, t(LEFT));
+//y := x(field not in SET(x, field2));
+//Once filters are moved in child queries then it can occur even when the common project cannot be hoisted.
 
 //Currently nearly all functional attributes are expanded when the call is parsed.
 //This is potentially inefficient, and makes it hard to dynamically control whether functions are expanded in line or generated out of line.

+ 0 - 2
ecl/hql/hqlpmap.cpp

@@ -127,11 +127,9 @@ IHqlExpression * replaceSelector(IHqlExpression * expr, IHqlExpression * oldData
     if (ret)
         return ret;
 
-#ifndef ENSURE_SELSEQ_UID
     node_operator op = oldDataset->getOperator();
     if (op == no_left || op == no_right)
         return newReplaceSelector(expr, oldDataset, newDataset);
-#endif
 
     HqlMapSelectorTransformer transformer(oldDataset, newDataset);
     return transformer.transformRoot(expr);

+ 0 - 9
ecl/hql/hqltrans.cpp

@@ -258,9 +258,6 @@ extern HQL_API bool isTransformTracing() { return tracing; }
 //if it does return the number of arguments that aren't hidden
 unsigned activityHidesSelectorGetNumNonHidden(IHqlExpression * expr, IHqlExpression * selector)
 {
-#ifdef ENSURE_SELSEQ_UID
-    return 0;
-#endif
     if (!selector)
         return 0;
     node_operator op = selector->getOperator();
@@ -1995,9 +1992,7 @@ HqlMapSelectorTransformer::HqlMapSelectorTransformer(IHqlExpression * oldDataset
         newDataset.setown(ensureActiveRow(newDataset));
 
     node_operator op = oldDataset->getOperator();
-#ifndef ENSURE_SELSEQ_UID
     assertex(op != no_left && op != no_right);
-#endif
     if (oldDataset->isDatarow() || (op == no_activetable) || (op == no_selfref))
     {
         setMappingOnly(oldDataset, newDataset);
@@ -2483,10 +2478,6 @@ bool onlyTransformOnce(IHqlExpression * expr)
     case no_sequence:
     case no_self:
     case no_selfref:
-#ifdef ENSURE_SELSEQ_UID
-    case no_left:
-    case no_right:
-#endif
     case no_flat:
     case no_any:
     case no_existsgroup:

+ 0 - 3
ecl/hqlcpp/hqlresource.cpp

@@ -2335,7 +2335,6 @@ protected:
 
     void gatherAmbiguousSelectors(IHqlExpression * expr)
     {
-#ifndef ENSURE_SELSEQ_UID
         //Horrible code to try and cope with ambiguous left selectors.
         //o Tree is ambiguous so same child expression can occur in different contexts - so can't depend on the context it is found in to work out if can hoist
         //o If any selector that is hidden within child expressions matches one in scope then can't hoist it.
@@ -2401,8 +2400,6 @@ protected:
                 break;
             }
         }
-
-#endif
     }
 
     bool isEvaluateable(IHqlExpression * ds, bool ignoreInline = false)

+ 3 - 4
ecl/hqlcpp/hqlttcpp.cpp

@@ -11788,10 +11788,9 @@ IHqlExpression * HqlTreeNormalizer::createTransformedBody(IHqlExpression * expr)
 #ifdef USE_SELSEQ_UID
             if (name == _selectorSequence_Atom)
             {
-#ifndef ENSURE_SELSEQ_UID
+                //Purely for testing what effect adding the unique sequences has on the parse time
                 if (options.simplifySelectorSequence)
                     return createDummySelectorSequence();
-#endif
 
                 //Ensure parameterised sequences generate a unique sequence number...
                 //Not sure the following is really necessary, but will reduce in memory tree size....
@@ -12031,7 +12030,6 @@ void normalizeHqlTree(HqlCppTranslator & translator, HqlExprArray & exprs)
     }
 
 #ifdef USE_SELSEQ_UID
-#ifndef ENSURE_SELSEQ_UID
     if (translator.queryOptions().detectAmbiguousSelector || translator.queryOptions().allowAmbiguousSelector)
     {
         LeftRightSelectorNormalizer transformer(translator.queryOptions().allowAmbiguousSelector);
@@ -12046,7 +12044,6 @@ void normalizeHqlTree(HqlCppTranslator & translator, HqlExprArray & exprs)
         }
     }
 #endif
-#endif
 
     if (false)
     {
@@ -12313,6 +12310,7 @@ bool HqlCppTranslator::transformGraphForGeneration(IHqlExpression * query, Workf
     checkNormalized(workflow);
     DEBUG_TIMER("EclServer: tree transform: stored results", msTick()-time4);
 
+#ifdef NORMALIZE_SELSEQ
 #ifdef USE_SELSEQ_UID
     {
         unsigned time = msTick();
@@ -12325,6 +12323,7 @@ bool HqlCppTranslator::transformGraphForGeneration(IHqlExpression * query, Workf
         //traceExpressions("after implicit alias", workflow);
     }
 #endif
+#endif
 
     if (queryOptions().createImplicitAliases)
     {