You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by li...@apache.org on 2023/03/02 02:44:47 UTC

[doris] branch master updated: [fix](planner) ignore aux expr when do push agg op (#17239)

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

lihaopeng pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new a5ae3072e5 [fix](planner) ignore aux expr when do push agg op (#17239)
a5ae3072e5 is described below

commit a5ae3072e5f5a63959b69be81a055c8bc47545a5
Author: morrySnow <10...@users.noreply.github.com>
AuthorDate: Thu Mar 2 10:44:40 2023 +0800

    [fix](planner) ignore aux expr when do push agg op (#17239)
---
 .../src/main/java/org/apache/doris/planner/SingleNodePlanner.java    | 4 +++-
 regression-test/suites/query_p0/aggregate/aggregate.groovy           | 5 +++++
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/fe/fe-core/src/main/java/org/apache/doris/planner/SingleNodePlanner.java b/fe/fe-core/src/main/java/org/apache/doris/planner/SingleNodePlanner.java
index 16962e87d8..b6abbb8b30 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/planner/SingleNodePlanner.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/planner/SingleNodePlanner.java
@@ -407,7 +407,9 @@ public class SingleNodePlanner {
                 break;
             }
             List<Expr> allConjuncts = analyzer.getAllConjuncts(selectStmt.getTableRefs().get(0).getId());
-            if (allConjuncts != null) {
+            // planner will generate some conjuncts for analysis. These conjuncts are marked as aux expr.
+            // we skip these conjuncts when do pushAggOp
+            if (allConjuncts != null && allConjuncts.stream().noneMatch(Expr::isAuxExpr)) {
                 break;
             }
 
diff --git a/regression-test/suites/query_p0/aggregate/aggregate.groovy b/regression-test/suites/query_p0/aggregate/aggregate.groovy
index 0053bf05b0..f5d0923161 100644
--- a/regression-test/suites/query_p0/aggregate/aggregate.groovy
+++ b/regression-test/suites/query_p0/aggregate/aggregate.groovy
@@ -296,4 +296,9 @@ suite("aggregate") {
     sql 'set enable_nereids_planner=true'
     qt_aggregate """ select avg(distinct c_bigint), avg(distinct c_double) from regression_test_query_p0_aggregate.${tableName} """
     qt_aggregate """ select count(distinct c_bigint),count(distinct c_double),count(distinct c_string),count(distinct c_date_1),count(distinct c_timestamp_1),count(distinct c_timestamp_2),count(distinct c_timestamp_3),count(distinct c_boolean) from regression_test_query_p0_aggregate.${tableName} """
+
+    explain {
+        sql("select /*+ SET_VAR(DISABLE_NEREIDS_RULES=\"ONE_PHASE_AGGREGATE_WITHOUT_DISTINCT\") */ count(*) from (select t2.c_bigint, t2.c_double, t2.c_string from (select c_bigint, c_double, c_string, c_date,c_timestamp, c_short_decimal from regression_test_query_p0_aggregate.${tableName}) t2)t1")
+        contains "pushAggOp=COUNT"
+    }
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org