You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by xi...@apache.org on 2022/06/07 09:09:20 UTC
[iotdb] branch xingtanzjr/fix_last_merge created (now dd273f85aa)
This is an automated email from the ASF dual-hosted git repository.
xingtanzjr pushed a change to branch xingtanzjr/fix_last_merge
in repository https://gitbox.apache.org/repos/asf/iotdb.git
at dd273f85aa Fix the issue that LastQuery lack MergeNode in some FI
This branch includes the following new commits:
new dd273f85aa Fix the issue that LastQuery lack MergeNode in some FI
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
[iotdb] 01/01: Fix the issue that LastQuery lack MergeNode in some FI
Posted by xi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
xingtanzjr pushed a commit to branch xingtanzjr/fix_last_merge
in repository https://gitbox.apache.org/repos/asf/iotdb.git
commit dd273f85aac68fe492d06883d4b0fbe5ced59dda
Author: Jinrui.Zhang <xi...@gmail.com>
AuthorDate: Tue Jun 7 17:09:08 2022 +0800
Fix the issue that LastQuery lack MergeNode in some FI
---
.../db/mpp/plan/planner/distribution/DistributionPlanContext.java | 6 ++++++
.../iotdb/db/mpp/plan/planner/distribution/SourceRewriter.java | 5 ++++-
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/plan/planner/distribution/DistributionPlanContext.java b/server/src/main/java/org/apache/iotdb/db/mpp/plan/planner/distribution/DistributionPlanContext.java
index 88f13eddf4..60a6a5f549 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/plan/planner/distribution/DistributionPlanContext.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/plan/planner/distribution/DistributionPlanContext.java
@@ -24,10 +24,12 @@ import org.apache.iotdb.db.mpp.common.MPPQueryContext;
public class DistributionPlanContext {
protected boolean isRoot;
protected MPPQueryContext queryContext;
+ protected boolean forceAddParent;
protected DistributionPlanContext(MPPQueryContext queryContext) {
this.isRoot = true;
this.queryContext = queryContext;
+ this.forceAddParent = false;
}
protected DistributionPlanContext copy() {
@@ -38,4 +40,8 @@ public class DistributionPlanContext {
this.isRoot = isRoot;
return this;
}
+
+ protected void setForceAddParent(boolean forceAddParent) {
+ this.forceAddParent = forceAddParent;
+ }
}
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/plan/planner/distribution/SourceRewriter.java b/server/src/main/java/org/apache/iotdb/db/mpp/plan/planner/distribution/SourceRewriter.java
index c646930fc1..676d93b3b4 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/plan/planner/distribution/SourceRewriter.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/plan/planner/distribution/SourceRewriter.java
@@ -372,6 +372,9 @@ public class SourceRewriter extends SimplePlanNodeRewriter<DistributionPlanConte
@Override
public PlanNode visitLastQueryMerge(LastQueryMergeNode node, DistributionPlanContext context) {
+ // For last query, we need to keep every FI's root node is LastQueryMergeNode. So we
+ // force every region group have a parent node even if there is only 1 child for it.
+ context.setForceAddParent(true);
return processRawMultiChildNode(node, context);
}
@@ -419,7 +422,7 @@ public class SourceRewriter extends SimplePlanNodeRewriter<DistributionPlanConte
final boolean[] addParent = {false};
sourceGroup.forEach(
(dataRegion, seriesScanNodes) -> {
- if (seriesScanNodes.size() == 1) {
+ if (seriesScanNodes.size() == 1 && !context.forceAddParent) {
root.addChild(seriesScanNodes.get(0));
} else {
if (!addParent[0]) {