浏览代码

HPCC-17782 Fix error with PARALLEL/SEQUENTIAL used in a child query

Signed-off-by: Gavin Halliday <gavin.halliday@lexisnexis.com>
Gavin Halliday 8 年之前
父节点
当前提交
d38790a616
共有 3 个文件被更改,包括 54 次插入4 次删除
  1. 7 4
      ecl/eclagent/eclgraph.cpp
  2. 16 0
      testing/regress/ecl/key/loop3.xml
  3. 31 0
      testing/regress/ecl/loop3.ecl

+ 7 - 4
ecl/eclagent/eclgraph.cpp

@@ -591,7 +591,8 @@ bool EclGraphElement::prepare(IAgentContext & agent, const byte * parentExtract,
             break;
         case TAKif:
             {
-                Owned<IHThorArg> helper = createHelper(agent, NULL);
+                assertex(!subgraph->owner);
+                Owned<IHThorArg> helper = createHelper(agent, subgraph->owner);
                 try
                 {
                     helper->onStart(NULL, NULL);
@@ -641,7 +642,8 @@ bool EclGraphElement::prepare(IAgentContext & agent, const byte * parentExtract,
         //However that is far from trivial, so for the moment conditional statements won't be supported by hthor.
         case TAKifaction:
             {
-                Owned<IHThorArg> helper = createHelper(agent, NULL);
+                assertex(!subgraph->owner);
+                Owned<IHThorArg> helper = createHelper(agent, subgraph->owner);
                 //Problem if this is done in a child query...
                 try
                 {
@@ -658,7 +660,7 @@ bool EclGraphElement::prepare(IAgentContext & agent, const byte * parentExtract,
         case TAKsequential:
         case TAKparallel:
             {
-                Owned<IHThorArg> helper = createHelper(agent, NULL);
+                Owned<IHThorArg> helper = createHelper(agent, subgraph->owner);
                 unsigned numBranches = (kind == TAKsequential) ? 
                                         ((IHThorSequentialArg *)helper.get())->numBranches() : 
                                         ((IHThorParallelArg *)helper.get())->numBranches();
@@ -669,7 +671,8 @@ bool EclGraphElement::prepare(IAgentContext & agent, const byte * parentExtract,
 #endif
         case TAKcase:
             {
-                Owned<IHThorArg> helper = createHelper(agent, NULL);
+                assertex(!subgraph->owner);
+                Owned<IHThorArg> helper = createHelper(agent, subgraph->owner);
                 try
                 {
                     helper->onStart(NULL, NULL);

+ 16 - 0
testing/regress/ecl/key/loop3.xml

@@ -0,0 +1,16 @@
+<Dataset name='o1'>
+ <Row><id>3</id></Row>
+ <Row><id>3</id></Row>
+ <Row><id>3</id></Row>
+</Dataset>
+<Dataset name='o2'>
+ <Row><id>1</id></Row>
+ <Row><id>1</id></Row>
+ <Row><id>1</id></Row>
+</Dataset>
+<Dataset name='Result 3'>
+ <Row><id>1</id></Row>
+ <Row><id>2</id></Row>
+ <Row><id>3</id></Row>
+ <Row><id>4</id></Row>
+</Dataset>

+ 31 - 0
testing/regress/ecl/loop3.ecl

@@ -0,0 +1,31 @@
+/*##############################################################################
+
+    HPCC SYSTEMS software Copyright (C) 2017 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.
+############################################################################## */
+
+r := { unsigned id };
+ds := dataset([1,2,3,4], r);
+
+
+f(dataset(r) inDs) := FUNCTION
+
+    o1 := output(inDs((id % 4) = 3),named('o1'),extend);
+    o2 := output(inDs((id % 4) = 1),named('o2'),extend);
+    return WHEN(inDs, parallel(o1, o2));
+END;
+
+l := LOOP(ds, 3, f(ROWS(LEFT)));
+
+output(l);