浏览代码

Merge pull request #3785 from ghalliday/issue8437

HPCC-8437 Don't generate DISTRIBUTE activities inside child graphs

Reviewed-By: Richard Chapman <rchapman@hpccsystems.com>
Richard Chapman 12 年之前
父节点
当前提交
03b0df9f4f
共有 5 个文件被更改,包括 169 次插入137 次删除
  1. 1 1
      ecl/hqlcpp/hqlckey.cpp
  2. 2 2
      ecl/hqlcpp/hqlcpp.ipp
  3. 2 2
      ecl/hqlcpp/hqlcppds.cpp
  4. 132 132
      ecl/hqlcpp/hqlhtcpp.cpp
  5. 32 0
      ecl/regress/issue8437.ecl

+ 1 - 1
ecl/hqlcpp/hqlckey.cpp

@@ -1438,7 +1438,7 @@ ABoundActivity * HqlCppTranslator::doBuildActivityKeyedJoinOrDenormalize(BuildCt
 
 ABoundActivity * HqlCppTranslator::doBuildActivityKeyedDistribute(BuildCtx & ctx, IHqlExpression * expr)
 {
-    if (!targetThor())
+    if (!targetThor() || insideChildQuery(ctx))
         return buildCachedActivity(ctx, expr->queryChild(0));
 
     HqlExprArray leftSorts, rightSorts;

+ 2 - 2
ecl/hqlcpp/hqlcpp.ipp

@@ -481,7 +481,7 @@ public:
     Linked<IPropertyTree> graph;
 };
 
-enum SubGraphType { SubGraphRoot, SubGraphRemote, SubGraphChild };
+enum SubGraphType { SubGraphRoot, SubGraphRemote, SubGraphChild, SubGraphLoop };
 
 struct SubGraphInfo : public HqlExprAssociation
 {
@@ -1646,7 +1646,7 @@ public:
 
     EvalContext * queryEvalContext(BuildCtx & ctx)          { return (EvalContext *)ctx.queryFirstAssociation(AssocExtractContext); }
     inline unsigned nextActivityId()                        { return ++curActivityId; }
-    bool insideChildGraph(BuildCtx & ctx);
+    bool insideChildOrLoopGraph(BuildCtx & ctx);
     bool insideChildQuery(BuildCtx & ctx);
     bool insideRemoteGraph(BuildCtx & ctx);
     bool isCurrentActiveGraph(BuildCtx & ctx, IHqlExpression * graphTag);

+ 2 - 2
ecl/hqlcpp/hqlcppds.cpp

@@ -1392,7 +1392,7 @@ unique_id_t ChildGraphBuilder::buildLoopBody(BuildCtx & ctx, bool multiInstance)
     createBuilderAlias(subctx, extractBuilder);
 
     translator.beginExtract(ctx, extractBuilder);
-    translator.doBuildThorSubGraph(ctx, resourced, SubGraphChild, id, represents);
+    translator.doBuildThorSubGraph(ctx, resourced, SubGraphLoop, id, represents);
     translator.endExtract(ctx, extractBuilder);
 
     return id;
@@ -1503,7 +1503,7 @@ unique_id_t ChildGraphBuilder::buildGraphLoopBody(BuildCtx & ctx, bool isParalle
     createBuilderAlias(subctx, extractBuilder);
 
     translator.beginExtract(ctx, extractBuilder);
-    translator.doBuildThorSubGraph(ctx, resourced, SubGraphChild, id, represents);
+    translator.doBuildThorSubGraph(ctx, resourced, SubGraphLoop, id, represents);
     translator.endExtract(ctx, extractBuilder);
 
     return id;

文件差异内容过多而无法显示
+ 132 - 132
ecl/hqlcpp/hqlhtcpp.cpp


+ 32 - 0
ecl/regress/issue8437.ecl

@@ -0,0 +1,32 @@
+/*##############################################################################
+
+    HPCC SYSTEMS software Copyright (C) 2012 HPCC Systems.
+
+    Licensed under the Apache License, Version 2.0 (the "License");
+    you may not use this file except in compliance with the License.
+    You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+############################################################################## */
+
+
+r1 := { unsigned id, string name; string name2};
+
+r3 := { dataset(r1) children, dataset(r1) children2 };
+r2 := { unsigned id, r3 r };
+
+s := dataset([{0,[{1,'Gavin','Hawthorn'},{2,'Jason','Jones'}],[]}], r2);
+
+r2 t(r2 l) := TRANSFORM
+    SELF.r.children := DISTRIBUTE(l.r.children, HASH(id));
+    SELF := l;
+END;
+
+p := PROJECT(NOFOLD(s), t(LEFT));
+output(p);