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

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

commit 634492a8f3eab19042e92a19efbf13cf1fb919a3
Author: Jinrui.Zhang <[email protected]>
AuthorDate: Fri May 27 20:43:01 2022 +0800

    fix the issue in exchange node adder
---
 .../iotdb/db/mpp/plan/planner/distribution/ExchangeNodeAdder.java | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git 
a/server/src/main/java/org/apache/iotdb/db/mpp/plan/planner/distribution/ExchangeNodeAdder.java
 
b/server/src/main/java/org/apache/iotdb/db/mpp/plan/planner/distribution/ExchangeNodeAdder.java
index 6c502c464f..70982ca1fc 100644
--- 
a/server/src/main/java/org/apache/iotdb/db/mpp/plan/planner/distribution/ExchangeNodeAdder.java
+++ 
b/server/src/main/java/org/apache/iotdb/db/mpp/plan/planner/distribution/ExchangeNodeAdder.java
@@ -263,7 +263,13 @@ public class ExchangeNodeAdder extends 
PlanVisitor<PlanNode, NodeGroupContext> {
         children.stream()
             .collect(
                 Collectors.groupingBy(
-                    child -> 
context.getNodeDistribution(child.getPlanNodeId()).region,
+                    child -> {
+                      TRegionReplicaSet region = 
context.getNodeDistribution(child.getPlanNodeId()).region;
+                      if (region == null && 
context.getNodeDistribution(child.getPlanNodeId()).type == 
NodeDistributionType.SAME_WITH_ALL_CHILDREN) {
+                        return 
calculateSchemaRegionByChildren(child.getChildren(), context);
+                      }
+                      return region;
+                    },
                     Collectors.counting()));
     // Step 2: return the RegionReplicaSet with max count
     return Collections.max(groupByRegion.entrySet(), 
Map.Entry.comparingByValue()).getKey();

Reply via email to