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

morningman pushed a commit to branch branch-1.2-lts
in repository https://gitbox.apache.org/repos/asf/doris.git

commit 9d1fd76e2fd731fed83994d8c20539841d2cb7b4
Author: morrySnow <101034200+morrys...@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.
---
 .../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    | 11 +++++++----
 3 files changed, 17 insertions(+), 4 deletions(-)

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 235fe4a6ff..b9f69ec915 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
@@ -397,6 +397,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 cd06915a8c..aa88314b4f 100644
--- a/regression-test/data/query_p0/aggregate/aggregate.out
+++ b/regression-test/data/query_p0/aggregate/aggregate.out
@@ -683,3 +683,9 @@ TESTING     AGAIN
 8      255
 9      1991
 
+-- !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 0d2ac9afcc..ef7d74fa65 100644
--- a/regression-test/suites/query_p0/aggregate/aggregate.groovy
+++ b/regression-test/suites/query_p0/aggregate/aggregate.groovy
@@ -292,8 +292,11 @@ suite("aggregate") {
     sql"""create table tempbaseall PROPERTIES("replication_num" = "1")  as 
select k1, k2 from baseall where k1 is not null;"""
     qt_aggregate32"select k1, k2 from (select k1, max(k2) as k2 from 
tempbaseall where k1 > 0 group by k1 order by k1)a where k1 > 0 and k1 < 10 
order by k1;"
 
-    explain {
-        sql("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")
-        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-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to