You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by la...@apache.org on 2024/01/11 03:02:10 UTC
(iotdb) branch FixGroupByLevel created (now 36c26e42c31)
This is an automated email from the ASF dual-hosted git repository.
lancelly pushed a change to branch FixGroupByLevel
in repository https://gitbox.apache.org/repos/asf/iotdb.git
at 36c26e42c31 fix
This branch includes the following new commits:
new 36c26e42c31 fix
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
Posted by la...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
lancelly pushed a commit to branch FixGroupByLevel
in repository https://gitbox.apache.org/repos/asf/iotdb.git
commit 36c26e42c3188678dbda34f10feb1c39ebc0824b
Author: lancelly <14...@qq.com>
AuthorDate: Thu Jan 11 11:01:52 2024 +0800
fix
---
.../plan/planner/distribution/SourceRewriter.java | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/distribution/SourceRewriter.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/distribution/SourceRewriter.java
index 751258628f9..b8d279ff8dc 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/distribution/SourceRewriter.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/distribution/SourceRewriter.java
@@ -1210,15 +1210,17 @@ public class SourceRewriter extends SimplePlanNodeRewriter<DistributionPlanConte
Map<TRegionReplicaSet, List<SeriesAggregationSourceNode>> sourceGroup,
DistributionPlanContext context) {
GroupByLevelNode newRoot = (GroupByLevelNode) root.clone();
+ int maxSize = sourceGroup.values().stream().mapToInt(List::size).max().orElse(0);
final boolean[] addParent = {false};
sourceGroup.forEach(
(dataRegion, sourceNodes) -> {
- if (sourceNodes.size() == 1) {
+ if (sourceGroup.size() == 1 || sourceNodes.size() == 1) {
newRoot.addChild(sourceNodes.get(0));
} else {
- if (!addParent[0]) {
+ if (sourceNodes.size() == maxSize && !addParent[0]) {
sourceNodes.forEach(newRoot::addChild);
addParent[0] = true;
+ context.queryContext.setMainFragmentLocatedRegion(dataRegion);
} else {
GroupByLevelNode parentOfGroup = (GroupByLevelNode) root.clone();
parentOfGroup.setPlanNodeId(context.queryContext.getQueryId().genPlanNodeId());
@@ -1348,15 +1350,17 @@ public class SourceRewriter extends SimplePlanNodeRewriter<DistributionPlanConte
Map<TRegionReplicaSet, List<SeriesAggregationSourceNode>> sourceGroup,
DistributionPlanContext context) {
GroupByTagNode newRoot = (GroupByTagNode) root.clone();
+ int maxSize = sourceGroup.values().stream().mapToInt(List::size).max().orElse(0);
final boolean[] addParent = {false};
sourceGroup.forEach(
(dataRegion, sourceNodes) -> {
- if (sourceNodes.size() == 1) {
+ if (sourceGroup.size() == 1 || sourceNodes.size() == 1) {
newRoot.addChild(sourceNodes.get(0));
} else {
- if (!addParent[0]) {
+ if (sourceNodes.size() == maxSize && !addParent[0]) {
sourceNodes.forEach(newRoot::addChild);
addParent[0] = true;
+ context.queryContext.setMainFragmentLocatedRegion(dataRegion);
} else {
HorizontallyConcatNode horizontallyConcatNode =
new HorizontallyConcatNode(context.queryContext.getQueryId().genPlanNodeId());