This is an automated email from the ASF dual-hosted git repository. zyk pushed a commit to branch rc/1.1.0 in repository https://gitbox.apache.org/repos/asf/iotdb.git
commit 109246000c59d9c5b439334873cd8503fbaf7031 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,
