Selaa lähdekoodia

HPCC-22259 Support output to FILE/PIPE inside potentially inline WHEN

Signed-off-by: Gavin Halliday <gavin.halliday@lexisnexis.com>
Gavin Halliday 6 vuotta sitten
vanhempi
commit
4b17d6c2b9
3 muutettua tiedostoa jossa 27 lisäystä ja 2 poistoa
  1. 0 2
      ecl/hqlcpp/hqlcpp.cpp
  2. 3 0
      ecl/hqlcpp/hqlhtcpp.cpp
  3. 24 0
      ecl/regress/issue22259.ecl

+ 0 - 2
ecl/hqlcpp/hqlcpp.cpp

@@ -3844,8 +3844,6 @@ void HqlCppTranslator::buildStmt(BuildCtx & _ctx, IHqlExpression * expr)
         doBuildStmtUpdate(ctx, expr);
         return;
     case no_output:
-        if (queryRealChild(expr, 1))
-            throwError1(HQLERR_NotSupportedInsideNoThor, "OUTPUT to file");
         doBuildStmtOutput(ctx, expr);
         return;
     case no_subgraph:

+ 3 - 0
ecl/hqlcpp/hqlhtcpp.cpp

@@ -11656,6 +11656,9 @@ void HqlCppTranslator::doBuildStmtOutput(BuildCtx & ctx, IHqlExpression * expr)
     if (expr->hasAttribute(groupedAtom) && (dataset->getOperator() != no_null))
         throwError1(HQLERR_NotSupportedInsideNoThor, "Grouped OUTPUT");
 
+    if (queryRealChild(expr, 1))
+        throwError1(HQLERR_NotSupportedInsideNoThor, "OUTPUT to file");
+
     LinkedHqlExpr seq = querySequence(expr);
     LinkedHqlExpr name = queryResultName(expr);
     assertex(seq != NULL);

+ 24 - 0
ecl/regress/issue22259.ecl

@@ -0,0 +1,24 @@
+import Std.Str;
+
+rec := RECORD
+ string f1;
+END;
+ds := DATASET([{'a'},{'b'}], rec);
+
+dofunc(string l) := FUNCTION
+ o1 := OUTPUT(ds, , PIPE('/home/jsmith/tmp/pipecmd'));
+ RETURN WHEN(true,o1,BEFORE);
+END;
+rec mytrans(rec l) := TRANSFORM
+ SELF.f1 := IF(dofunc(l.f1), 'a', 'b');
+END;
+rec myfailtrans(STRING x) := TRANSFORM
+ SELF.f1 := x;
+END;
+
+p2 := PROJECT(ds, mytrans(LEFT));
+c2 := CATCH(NOFOLD(p2), ONFAIL(myFailTrans(FAILMESSAGE)));
+
+SEQUENTIAL(
+ OUTPUT(c2);
+);