Przeglądaj źródła

HPCC-10420 Ensure contents of expr attributes are hoisted when required

Signed-off-by: Gavin Halliday <gavin.halliday@lexisnexis.com>
Gavin Halliday 11 lat temu
rodzic
commit
2d12831547
3 zmienionych plików z 19 dodań i 2 usunięć
  1. 2 0
      ecl/hqlcpp/hqlcerrors.hpp
  2. 6 1
      ecl/hqlcpp/hqlcppds.cpp
  3. 11 1
      ecl/hqlcpp/hqlresource.cpp

+ 2 - 0
ecl/hqlcpp/hqlcerrors.hpp

@@ -209,6 +209,7 @@
 #define HQLERR_UnexpectedOptionValue_XY         4189
 #define HQLERR_VariableRowMustBeLinked          4190
 #define HQLERR_UserCodeNotAllowed               4191
+#define HQLERR_StreamInputUsedDirectly          4192
 
 //Warnings....
 #define HQLWRN_PersistDataNotLikely             4500
@@ -494,6 +495,7 @@
 #define HQLERR_UnexpectedOptionValue_XY_Text    "Unexpected value for option %s: %s"
 #define HQLERR_VariableRowMustBeLinked_Text     "External function '%s' cannot return a non-linked variable length row"
 #define HQLERR_UserCodeNotAllowed_Text          "Workunit-supplied code is not permitted on this system"
+#define HQLERR_StreamInputUsedDirectly_Text     "Library input used directly in a child query"
 
 //Warnings.
 #define HQLWRN_CannotRecreateDistribution_Text  "Cannot recreate the distribution for a persistent dataset"

+ 6 - 1
ecl/hqlcpp/hqlcppds.cpp

@@ -4975,7 +4975,12 @@ IHqlExpression * HqlCppTranslator::buildGetLocalResult(BuildCtx & ctx, IHqlExpre
 void HqlCppTranslator::doBuildAssignGetGraphResult(BuildCtx & ctx, const CHqlBoundTarget & target, IHqlExpression * expr)
 {
     if (expr->hasAttribute(_streaming_Atom))
-        throwError(HQLERR_LoopTooComplexForParallel);
+    {
+        if (insideLibrary())
+            throwError(HQLERR_StreamInputUsedDirectly);
+        else
+            throwError(HQLERR_LoopTooComplexForParallel);
+    }
 
     if (expr->hasAttribute(externalAtom))
     {

+ 11 - 1
ecl/hqlcpp/hqlresource.cpp

@@ -2124,7 +2124,6 @@ protected:
 };
 
 
-
 class EclChildSplitPointLocator : public EclHoistLocator
 {
 public:
@@ -2374,6 +2373,17 @@ protected:
                     conditionalDepth--;
                 break;
             }
+        case no_attr_expr:
+            //Ignore internal tracking attributes e.g., _selectors_Atom
+            if (!isInternalAttributeName(expr->queryName()))
+            {
+                //Default action for no_attr_expr is to not walk children, but we need to here.
+                bool wasExecutedOnce = executedOnce;
+                executedOnce = true;
+                analyseChildren(expr);
+                executedOnce = wasExecutedOnce;
+            }
+            break;
         default:
             NewHqlTransformer::analyseExpr(expr);
             break;