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 2022/07/22 01:09:15 UTC
[iotdb] branch master updated: [IoTDB-3842] Fix the issue that GroupByLevel cannot use value filter
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 3b986fb935 [IoTDB-3842] Fix the issue that GroupByLevel cannot use value filter
3b986fb935 is described below
commit 3b986fb9352685bd2922ab8028dcf82a0ae12cac
Author: Zhang.Jinrui <xi...@gmail.com>
AuthorDate: Fri Jul 22 09:09:08 2022 +0800
[IoTDB-3842] Fix the issue that GroupByLevel cannot use value filter
---
.../mpp/plan/planner/distribution/SourceRewriter.java | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
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 51618cbe64..ce20f83396 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
@@ -531,6 +531,9 @@ public class SourceRewriter extends SimplePlanNodeRewriter<DistributionPlanConte
@Override
public PlanNode visitGroupByLevel(GroupByLevelNode root, DistributionPlanContext context) {
+ if (shouldUseNaiveAggregation(root)) {
+ return defaultRewrite(root, context);
+ }
// Firstly, we build the tree structure for GroupByLevelNode
List<SeriesAggregationSourceNode> sources = splitAggregationSourceByPartition(root, context);
Map<TRegionReplicaSet, List<SeriesAggregationSourceNode>> sourceGroup =
@@ -554,6 +557,22 @@ public class SourceRewriter extends SimplePlanNodeRewriter<DistributionPlanConte
return newRoot;
}
+ // If the Aggregation Query contains value filter, we need to use the naive query plan
+ // for it. That is, do the raw data query and then do the aggregation operation.
+ // Currently, the method to judge whether the query should use naive query plan is whether
+ // AggregationNode is contained in the PlanNode tree of logical plan.
+ private boolean shouldUseNaiveAggregation(PlanNode root) {
+ if (root instanceof AggregationNode) {
+ return true;
+ }
+ for (PlanNode child : root.getChildren()) {
+ if (shouldUseNaiveAggregation(child)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
private GroupByLevelNode groupSourcesForGroupByLevelWithSlidingWindow(
GroupByLevelNode root,
SlidingWindowAggregationNode slidingWindowNode,