瀏覽代碼

Merge pull request #6561 from richardkchapman/if-when

HPCC-12378 WHEN clause triggered on the false branch of an IF, in Roxie

Reviewed-by: Gavin Halliday <ghalliday@hpccsystems.com>
Gavin Halliday 10 年之前
父節點
當前提交
8468f89fbc
共有 3 個文件被更改,包括 19 次插入1 次删除
  1. 6 1
      roxie/ccd/ccdserver.cpp
  2. 10 0
      testing/regress/ecl/ifwhen.ecl
  3. 3 0
      testing/regress/ecl/key/ifwhen.xml

+ 6 - 1
roxie/ccd/ccdserver.cpp

@@ -19572,7 +19572,12 @@ public:
 
     virtual void stop(bool aborting)
     {
-        if (state != STATEstopped)
+        if (state == STATEreset)
+        {
+            stopDependencies(savedExtractSize, savedExtract, WhenSuccessId);
+            stopDependencies(savedExtractSize, savedExtract, WhenFailureId);
+        }
+        else if (state != STATEstopped)
         {
             stopDependencies(savedExtractSize, savedExtract, aborting ? WhenSuccessId : WhenFailureId);  // These ones don't get executed
             executeDependencies(savedExtractSize, savedExtract, aborting ? WhenFailureId : WhenSuccessId); // These ones do

+ 10 - 0
testing/regress/ecl/ifwhen.ecl

@@ -0,0 +1,10 @@
+ds1 := DATASET(['Should not appear'], {STRING msg});
+ds2 := DATASET(['Should not appear either'], {STRING msg});
+ds3 := DATASET(['Should appear'],{STRING msg});
+
+whenClause := OUTPUT(ds1);
+
+falsearm := WHEN(ds2, whenClause, SUCCESS);
+truearm := ds3;
+
+OUTPUT(IF(nofold(true), truearm, falsearm));

+ 3 - 0
testing/regress/ecl/key/ifwhen.xml

@@ -0,0 +1,3 @@
+<Dataset name='Result 2'>
+ <Row><msg>Should appear</msg></Row>
+</Dataset>