This is an automated email from the ASF dual-hosted git repository.

jackietien pushed a commit to branch rel/1.1
in repository https://gitbox.apache.org/repos/asf/iotdb.git


The following commit(s) were added to refs/heads/rel/1.1 by this push:
     new 8ad9a7d002 fix show queries after introduce Shuffle
8ad9a7d002 is described below

commit 8ad9a7d002a03786e796bc3cdd2cf85d0d754f04
Author: Weihao Li <[email protected]>
AuthorDate: Mon Mar 20 13:59:37 2023 +0800

    fix show queries after introduce Shuffle
---
 .../planner/distribution/DistributionPlanner.java   | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git 
a/server/src/main/java/org/apache/iotdb/db/mpp/plan/planner/distribution/DistributionPlanner.java
 
b/server/src/main/java/org/apache/iotdb/db/mpp/plan/planner/distribution/DistributionPlanner.java
index 6b58ae1fe7..2f1e85aedf 100644
--- 
a/server/src/main/java/org/apache/iotdb/db/mpp/plan/planner/distribution/DistributionPlanner.java
+++ 
b/server/src/main/java/org/apache/iotdb/db/mpp/plan/planner/distribution/DistributionPlanner.java
@@ -103,6 +103,11 @@ public class DistributionPlanner {
       return;
     }
 
+    if (analysis.isVirtualSource()) {
+      adjustUpStreamHelper(root, context);
+      return;
+    }
+
     final boolean needShuffleSinkNode =
         analysis.getStatement() instanceof QueryStatement
             && needShuffleSinkNode((QueryStatement) analysis.getStatement(), 
context);
@@ -110,6 +115,22 @@ public class DistributionPlanner {
     adjustUpStreamHelper(root, new HashMap<>(), needShuffleSinkNode, context);
   }
 
+  private void adjustUpStreamHelper(PlanNode root, NodeGroupContext context) {
+    for (PlanNode child : root.getChildren()) {
+      adjustUpStreamHelper(child, context);
+      if (child instanceof ExchangeNode) {
+        ExchangeNode exchangeNode = (ExchangeNode) child;
+        MultiChildrenSinkNode newChild =
+            new 
IdentitySinkNode(context.queryContext.getQueryId().genPlanNodeId());
+        newChild.addChild(exchangeNode.getChild());
+        newChild.addDownStreamChannelLocation(
+            new 
DownStreamChannelLocation(exchangeNode.getPlanNodeId().toString()));
+        exchangeNode.setChild(newChild);
+        
exchangeNode.setIndexOfUpstreamSinkHandle(newChild.getCurrentLastIndex());
+      }
+    }
+  }
+
   private void adjustUpStreamHelper(
       PlanNode root,
       Map<TRegionReplicaSet, MultiChildrenSinkNode> memo,

Reply via email to