Quellcode durchsuchen

HPCC-10381 Add a targetIndex to the edges for action "inputs"

Signed-off-by: Gavin Halliday <gavin.halliday@lexisnexis.com>
Gavin Halliday vor 11 Jahren
Ursprung
Commit
a1ada161fe
2 geänderte Dateien mit 26 neuen und 26 gelöschten Zeilen
  1. 4 3
      ecl/hqlcpp/hqlcpp.ipp
  2. 22 23
      ecl/hqlcpp/hqlhtcpp.cpp

+ 4 - 3
ecl/hqlcpp/hqlcpp.ipp

@@ -1533,9 +1533,10 @@ public:
     void expandAliasScope(BuildCtx & ctx, IHqlExpression * expr);
     IHqlExpression * queryExpandAliasScope(BuildCtx & ctx, IHqlExpression * expr);
 
-    void addDependency(BuildCtx & ctx, ABoundActivity * element, ABoundActivity * dependent, IAtom * kind, const char * label=NULL, int controlId = 0);
-    void addDependency(BuildCtx & ctx, ABoundActivity * element, ActivityInstance * instance, IAtom * kind, const char * label=NULL, int controlId = 0);
-    void addDependency(BuildCtx & ctx, ABoundActivity * sourceActivity, IPropertyTree * sinkGraph, ABoundActivity * sinkActivity, IAtom * kind, const char * label, int whenId);
+    void addDependency(BuildCtx & ctx, ABoundActivity * element, ABoundActivity * dependent, IAtom * kind, const char * label=NULL);
+    void addDependency(BuildCtx & ctx, ABoundActivity * element, ActivityInstance * instance, IAtom * kind, const char * label=NULL);
+    void addDependency(BuildCtx & ctx, ABoundActivity * sourceActivity, IPropertyTree * sinkGraph, ABoundActivity * sinkActivity, IAtom * kind, const char * label, unsigned inputIndex, int whenId);
+    void addActionConnection(BuildCtx & ctx, ABoundActivity * element, ActivityInstance * instance, IAtom * kind, const char * label, unsigned inputIndex, int whenId);
     void addFileDependency(IHqlExpression * name, ABoundActivity * whoAmI);
 
     void doBuildClearAggregateRecord(BuildCtx & ctx, IHqlExpression * record, IHqlExpression * self, IHqlExpression * transform);

+ 22 - 23
ecl/hqlcpp/hqlhtcpp.cpp

@@ -6906,7 +6906,7 @@ BoundRow * HqlCppTranslator::resolveSelectorDataset(BuildCtx & ctx, IHqlExpressi
 
 //---------------------------------------------------------------------------
 
-void HqlCppTranslator::addDependency(BuildCtx & ctx, ABoundActivity * sourceActivity, IPropertyTree * sinkGraphTree, ABoundActivity * sinkActivity, IAtom * kind, const char * label, int whenId)
+void HqlCppTranslator::addDependency(BuildCtx & ctx, ABoundActivity * sourceActivity, IPropertyTree * sinkGraphTree, ABoundActivity * sinkActivity, IAtom * kind, const char * label, unsigned inputIndex, int whenId)
 {
     IPropertyTree * graphTree = NULL;
     if (sinkActivity->queryGraphId() == sourceActivity->queryGraphId())
@@ -6923,16 +6923,6 @@ void HqlCppTranslator::addDependency(BuildCtx & ctx, ABoundActivity * sourceActi
     StringBuffer idText;
     idText.append(sourceActivity->queryActivityId()).append('_').append(sinkActivity->queryActivityId());
 
-#if 0
-    StringBuffer edgeText;
-    edgeText.append("edge[@id=\").append(idText).append("\"]");
-    if (activeGraph->xgmml->hasProp(edgePath))
-        return;
-#endif
-
-//  if (outputIndex)
-//      idText.append("_").append(outputIndex);
-
     IPropertyTree *edge = createPTree();
     edge->setProp("@id", idText.str());
     if (label)
@@ -6942,6 +6932,8 @@ void HqlCppTranslator::addDependency(BuildCtx & ctx, ABoundActivity * sourceActi
         if (outputIndex)
             addGraphAttributeInt(edge, "_sourceIndex", outputIndex);
     }
+    if (inputIndex)
+        addGraphAttributeInt(edge, "_targetIndex", inputIndex);
 
     if (kind == childAtom)
     {
@@ -6977,14 +6969,21 @@ void HqlCppTranslator::addDependency(BuildCtx & ctx, ABoundActivity * sourceActi
     }
 }
 
-void HqlCppTranslator::addDependency(BuildCtx & ctx, ABoundActivity * element, ABoundActivity * dependent, IAtom * kind, const char * label, int whenId)
+void HqlCppTranslator::addDependency(BuildCtx & ctx, ABoundActivity * element, ABoundActivity * dependent, IAtom * kind, const char * label)
 {
-    addDependency(ctx, element, NULL, dependent, kind, label, whenId);
+    unsigned whenId = 0;
+    addDependency(ctx, element, NULL, dependent, kind, label, 0, whenId);
 }
 
-void HqlCppTranslator::addDependency(BuildCtx & ctx, ABoundActivity * element, ActivityInstance * instance, IAtom * kind, const char * label, int whenId)
+void HqlCppTranslator::addDependency(BuildCtx & ctx, ABoundActivity * element, ActivityInstance * instance, IAtom * kind, const char * label)
 {
-    addDependency(ctx, element, instance->querySubgraphNode(), instance->queryBoundActivity(), kind, label, whenId);
+    unsigned whenId = 0;
+    addDependency(ctx, element, instance->querySubgraphNode(), instance->queryBoundActivity(), kind, label, 0, whenId);
+}
+
+void HqlCppTranslator::addActionConnection(BuildCtx & ctx, ABoundActivity * element, ActivityInstance * instance, IAtom * kind, const char * label, unsigned inputIndex, int whenId)
+{
+    addDependency(ctx, element, instance->querySubgraphNode(), instance->queryBoundActivity(), kind, label, inputIndex, whenId);
 }
 
 void HqlCppTranslator::buildClearRecord(BuildCtx & ctx, IHqlExpression * dataset, IHqlExpression * record, int direction)
@@ -14768,10 +14767,10 @@ ABoundActivity * HqlCppTranslator::doBuildActivityExecuteWhen(BuildCtx & ctx, IH
     buildInstanceSuffix(instance);
 
     if (expr->isAction())
-        addDependency(ctx, boundDataset, instance, dependencyAtom, NULL, 1);
+        addActionConnection(ctx, boundDataset, instance, dependencyAtom, NULL, 0, 1);
     else
         buildConnectInputOutput(ctx, instance, boundDataset, 0, 0);
-    addDependency(ctx, associatedActivity, instance, dependencyAtom, label, when);
+    addActionConnection(ctx, associatedActivity, instance, dependencyAtom, label, 0, when);
 
     return instance->getBoundActivity();
 }
@@ -15691,9 +15690,9 @@ ABoundActivity * HqlCppTranslator::doBuildActivityIf(BuildCtx & ctx, IHqlExpress
         if (expr->isAction())
         {
             if (boundTrue)
-                addDependency(ctx, boundTrue, instance, dependencyAtom, firstLabel, 1);
+                addActionConnection(ctx, boundTrue, instance, dependencyAtom, firstLabel, 0, 1);
             if (boundFalse)
-                addDependency(ctx, boundFalse, instance, dependencyAtom, "False", 2);
+                addActionConnection(ctx, boundFalse, instance, dependencyAtom, "False", 1, 2);
         }
         else
         {
@@ -15738,7 +15737,7 @@ ABoundActivity * HqlCppTranslator::doBuildActivitySequentialParallel(BuildCtx &
         ABoundActivity & cur = (ABoundActivity&)boundActivities.item(j);
         StringBuffer temp;
         temp.append("Action #").append(j+1);
-        addDependency(ctx, &cur, instance, dependencyAtom, temp.str(), j+1);
+        addActionConnection(ctx, &cur, instance, dependencyAtom, temp.str(), j, j+1);
     }
 
     buildInstanceSuffix(instance);
@@ -15772,7 +15771,7 @@ ABoundActivity * HqlCppTranslator::doBuildActivityChoose(BuildCtx & ctx, IHqlExp
         ABoundActivity * boundBranch = &inputs.item(branchIdx);
         label.clear().append("Branch ").append(branchIdx+1);
         if (expr->isAction())
-            addDependency(ctx, boundBranch, instance, dependencyAtom, label.str(), branchIdx+1);
+            addActionConnection(ctx, boundBranch, instance, dependencyAtom, label.str(), branchIdx, branchIdx+1);
         else
             buildConnectInputOutput(ctx, instance, boundBranch, 0, branchIdx, label.str());
     }
@@ -15847,9 +15846,9 @@ ABoundActivity * HqlCppTranslator::doBuildActivityCase(BuildCtx & ctx, IHqlExpre
             label.clear().append("Branch ").append(branchIdx+1);
 
         if (expr->isAction())
-            addDependency(ctx, boundBranch, instance, dependencyAtom, label.str(), branchIdx+1);
+            addActionConnection(ctx, boundBranch, instance, dependencyAtom, label.str(), branchIdx, branchIdx+1);
         else
-            buildConnectInputOutput(ctx, instance, boundBranch, 0, idx-first, label.str());
+            buildConnectInputOutput(ctx, instance, boundBranch, 0, branchIdx, label.str());
     }
 
     args.append(*createConstant(unsignedType->castFrom(false, (__int64)max-1)));