Browse Source

Merge pull request #3952 from ghalliday/issue8781

HPCC-8781 Improved ONCE handling for roxie/hthor

Reviewed-By: Richard Chapman <rchapman@hpccsystems.com>
Richard Chapman 12 năm trước cách đây
mục cha
commit
3f2fb87811
3 tập tin đã thay đổi với 31 bổ sung7 xóa
  1. 15 0
      ecl/hqlcpp/hqlcpp.cpp
  2. 5 4
      ecl/hqlcpp/hqlcpp.ipp
  3. 11 3
      ecl/hqlcpp/hqlinline.cpp

+ 15 - 0
ecl/hqlcpp/hqlcpp.cpp

@@ -1892,6 +1892,21 @@ void HqlCppTranslator::overrideOptionsForQuery()
     options.minimizeWorkunitTemporaries = !options.workunitTemporaries || getDebugFlag("minimizeWorkunitTemporaries", false);//options.resourceConditionalActions);
 }
 
+
+bool HqlCppTranslator::needToSerializeToSlave(IHqlExpression * expr) const
+{
+    if (targetThor())
+        return true;
+    switch (expr->getOperator())
+    {
+    case no_getresult:
+    case no_workunit_dataset:
+        return !matchesConstantValue(queryPropertyChild(expr, sequenceAtom, 0), ResultSequenceOnce);
+    default:
+        return true;
+    }
+}
+
 IHqlExpression *HqlCppTranslator::addBigLiteral(const char *lit, unsigned litLen)
 {
     unsigned resid = code->addStringResource(litLen, lit);

+ 5 - 4
ecl/hqlcpp/hqlcpp.ipp

@@ -928,10 +928,10 @@ public:
     unsigned getSourceAggregateOptimizeFlags() const;
     inline void addGlobalOnWarning(IHqlExpression * setMetaExpr) { warningProcessor.addGlobalOnWarning(setMetaExpr); }
 
-    ClusterType getTargetClusterType() { return targetClusterType; }
-    inline bool targetRoxie() { return targetClusterType == RoxieCluster; }
-    inline bool targetHThor() { return targetClusterType == HThorCluster; }
-    inline bool targetThor() { return isThorCluster(targetClusterType); }
+    ClusterType getTargetClusterType() const { return targetClusterType; }
+    inline bool targetRoxie() const { return targetClusterType == RoxieCluster; }
+    inline bool targetHThor() const { return targetClusterType == HThorCluster; }
+    inline bool targetThor() const { return isThorCluster(targetClusterType); }
     inline IErrorReceiver * queryErrors() { return errors; }
     inline WarningProcessor & queryWarningProcessor() { return warningProcessor; }
 
@@ -1030,6 +1030,7 @@ public:
     void noteXpathUsed(IHqlExpression * expr);
 
     HqlCppOptions const & queryOptions() const { return options; }
+    bool needToSerializeToSlave(IHqlExpression * expr) const;
     ITimeReporter * queryTimeReporter() const { return timeReporter; }
 
     void updateClusterType();

+ 11 - 3
ecl/hqlcpp/hqlinline.cpp

@@ -1331,7 +1331,8 @@ bool EvalContext::evaluateInParent(BuildCtx & ctx, IHqlExpression * expr, bool h
     case no_getgraphresult:
         return !translator.isCurrentActiveGraph(ctx, expr->queryChild(1));
     case no_getresult:
-        return !matchesConstantValue(queryPropertyChild(expr, sequenceAtom, 0), ResultSequenceOnce);
+    case no_workunit_dataset:
+        return translator.needToSerializeToSlave(expr);
     case no_failcode:
     case no_failmessage:
     case no_fail:
@@ -1509,8 +1510,15 @@ void ClassEvalContext::createMemberAlias(CtxCollection & ctxs, BuildCtx & ctx, I
 
     const _ATOM serializeForm = internalAtom; // The format of serialized expressions in memory must match the internal serialization format
     CHqlBoundTarget tempTarget;
-    translator.buildTempExpr(*ctxs.evalctx, ctxs.declarectx, tempTarget, value, FormatNatural, false);
-    ensureSerialized(ctxs, tempTarget, serializeForm);
+    if (translator.needToSerializeToSlave(value))
+    {
+        translator.buildTempExpr(*ctxs.evalctx, ctxs.declarectx, tempTarget, value, FormatNatural, false);
+        ensureSerialized(ctxs, tempTarget, serializeForm);
+    }
+    else
+    {
+        translator.buildTempExpr(ctxs.clonectx, ctxs.declarectx, tempTarget, value, FormatNatural, false);
+    }
 
     tgt.setFromTarget(tempTarget);
     ctxs.declarectx.associateExpr(value, tgt);