You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ja...@apache.org on 2023/03/20 05:48:13 UTC

[iotdb] branch master updated: fix show queries after introduce Shuffle

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 806fc7c156 fix show queries after introduce Shuffle
806fc7c156 is described below

commit 806fc7c156d95e64c006c01a9f8b5018f5ab9729
Author: Weihao Li <60...@users.noreply.github.com>
AuthorDate: Mon Mar 20 13:48:02 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,