Quellcode durchsuchen

HPCC-16705 Returning nested dataset from embedded Python is not assuming LINKCOUNTED

Child datasets within the result should preferably be LINKCOUNTED by default.
The exception for calls to embedded code is really only required for embedded
C++.

Signed-off-by: Richard Chapman <rchapman@hpccsystems.com>
Richard Chapman vor 8 Jahren
Ursprung
Commit
e952c0498f
2 geänderte Dateien mit 38 neuen und 2 gelöschten Zeilen
  1. 5 2
      ecl/hqlcpp/hqlttcpp.cpp
  2. 33 0
      ecl/regress/implicitlink.ecl

+ 5 - 2
ecl/hqlcpp/hqlttcpp.cpp

@@ -9382,9 +9382,12 @@ IHqlExpression * HqlLinkedChildRowTransformer::createTransformedBody(IHqlExpress
             }
         }
         break;
-    case no_attr:
     case no_embedbody:
-        //Don't change the type of an embed body - otherwise result it will become link counted when not expected.
+        if (expr->queryAttribute(languageAtom))
+            break;
+        //Don't change the type of an embedded C++ body - otherwise result it will become link counted when not expected.
+        // Fall into...
+    case no_attr:
         return LINK(expr);
     }
     return QuickHqlTransformer::createTransformedBody(expr);

+ 33 - 0
ecl/regress/implicitlink.ecl

@@ -0,0 +1,33 @@
+IMPORT Python;
+
+nested := RECORD
+  integer value;
+END;
+
+parent := RECORD
+  DATASET(nested) nest;
+END;
+
+DATASET(parent) getP() := EMBED(Python)
+  return [
+          [
+           1,2,3,4
+          ],
+          [
+           5,6,7,8
+          ]
+         ]
+ENDEMBED;
+
+pcode(DATASET(parent) p) := EMBED(Python)
+  for child in p:
+   for c2 in child.nest:
+    print c2.value,
+ENDEMBED;
+
+ds := getp(); 
+//ds := DATASET([{[{1},{3}]}], parent);
+//ds;
+pcode(ds);
+
+