You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by yi...@apache.org on 2023/03/10 01:33:18 UTC

[doris] branch master updated: [fix](planner) should not turn on push agg op when olapscan has conjuncts on it (#17598)

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

yiguolei 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 006f7a91ac [fix](planner) should not turn on push agg op when olapscan has conjuncts on it (#17598)
006f7a91ac is described below

commit 006f7a91acd5b50c1d07b15654862ac8b3200fb3
Author: morrySnow <10...@users.noreply.github.com>
AuthorDate: Fri Mar 10 09:33:08 2023 +0800

    [fix](planner) should not turn on push agg op when olapscan has conjuncts on it (#17598)
    
    we should not set PushAggOp to any type, if olap scan already has conjunct on it.
---
 .../src/main/java/org/apache/doris/planner/SingleNodePlanner.java | 4 ++++
 regression-test/data/query_p0/aggregate/aggregate.out             | 6 ++++++
 regression-test/suites/query_p0/aggregate/aggregate.groovy        | 8 ++++++++
 3 files changed, 18 insertions(+)

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 a9d8cdc603..67591426dd 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
@@ -398,6 +398,10 @@ public class SingleNodePlanner {
                 break;
             }
 
+            if (CollectionUtils.isNotEmpty(root.getConjuncts())) {
+                break;
+            }
+
             // TODO: Support muti table in the future
             if (selectStmt.getTableRefs().size() != 1) {
                 break;
diff --git a/regression-test/data/query_p0/aggregate/aggregate.out b/regression-test/data/query_p0/aggregate/aggregate.out
index d9234ed13d..ebd92dcb60 100644
--- a/regression-test/data/query_p0/aggregate/aggregate.out
+++ b/regression-test/data/query_p0/aggregate/aggregate.out
@@ -689,3 +689,9 @@ TESTING	AGAIN
 -- !aggregate --
 9	9	10	8	7	7	7	2
 
+-- !subquery_with_inner_predicate --
+16
+
+-- !subquery_without_inner_predicate --
+7
+
diff --git a/regression-test/suites/query_p0/aggregate/aggregate.groovy b/regression-test/suites/query_p0/aggregate/aggregate.groovy
index f5d0923161..773d947845 100644
--- a/regression-test/suites/query_p0/aggregate/aggregate.groovy
+++ b/regression-test/suites/query_p0/aggregate/aggregate.groovy
@@ -301,4 +301,12 @@ suite("aggregate") {
         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"
     }
+
+    qt_subquery_with_inner_predicate """
+        select 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
+    """
+
+    qt_subquery_without_inner_predicate """
+        select 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} where c_bigint > 5000) t2)t1
+    """
 }


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