From fff1983f40c172d01a5178779509a5aea8793000 Mon Sep 17 00:00:00 2001 From: starocean999 <40539150+starocean999@users.noreply.github.com> Date: Wed, 19 Jul 2023 00:46:49 +0800 Subject: [PATCH] [fix](planner)use tupleId of agg node to get its unsigned conjuncts (#21949) --- .../src/main/java/org/apache/doris/analysis/Analyzer.java | 3 ++- .../data/nereids_p0/test_filter_pushdown_set.out | 6 ++++++ .../suites/nereids_p0/test_filter_pushdown_set.groovy | 3 +++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/Analyzer.java b/fe/fe-core/src/main/java/org/apache/doris/analysis/Analyzer.java index 33aa53412b..65cc119683 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/analysis/Analyzer.java +++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/Analyzer.java @@ -2420,7 +2420,8 @@ public class Analyzer { // constant conjuncts should be push down to all leaf node except agg node. // (see getPredicatesBoundedByGroupbysSourceExpr method) // so we need remove constant conjuncts when expr is not a leaf node. - List unassigned = getUnassignedConjuncts(node.getTblRefIds()); + List unassigned = getUnassignedConjuncts( + node instanceof AggregationNode ? node.getTupleIds() : node.getTblRefIds()); if (!node.getChildren().isEmpty() && !(node instanceof AggregationNode)) { unassigned = unassigned.stream() .filter(e -> !e.isConstant()).collect(Collectors.toList()); diff --git a/regression-test/data/nereids_p0/test_filter_pushdown_set.out b/regression-test/data/nereids_p0/test_filter_pushdown_set.out index ecf08434cc..42ecbc5ad8 100644 --- a/regression-test/data/nereids_p0/test_filter_pushdown_set.out +++ b/regression-test/data/nereids_p0/test_filter_pushdown_set.out @@ -2,3 +2,9 @@ -- !select1 -- 1 2 +-- !select2 -- +1 2 + +-- !select3 -- +1 2 + diff --git a/regression-test/suites/nereids_p0/test_filter_pushdown_set.groovy b/regression-test/suites/nereids_p0/test_filter_pushdown_set.groovy index e97ed2c24a..03c1b25798 100644 --- a/regression-test/suites/nereids_p0/test_filter_pushdown_set.groovy +++ b/regression-test/suites/nereids_p0/test_filter_pushdown_set.groovy @@ -19,4 +19,7 @@ sql "SET enable_nereids_planner=true" sql "SET enable_fallback_to_original_planner=false" qt_select1 'select * from (select 1 as a, 2 as b union all select 3, 3) t where a = 1;' + sql "SET enable_nereids_planner=false" + qt_select2 'select * from (select 1 as a, 2 as b union all select 3, 3) t where a = 1;' + qt_select3 'select * from (select 1 as a, 2 as b union select 3, 3) t where a = 1;' } \ No newline at end of file