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 b7f163e4d6d87032194dd2d5e804539eaf348c63
Author: HappenLee <happen...@hotmail.com>
AuthorDate: Wed Aug 9 10:21:20 2023 +0800

    [fix](agg) fix coredump caused by push down count aggregation (#22699)
    
    fix coredump caused by push down count aggregation
---
 .../apache/doris/planner/SingleNodePlanner.java    |  3 +-
 .../test_aggregate_push_down_agg.out               |  4 ++
 .../test_aggregate_push_down_agg.groovy            | 44 ++++++++++++++++++++++
 3 files changed, 50 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 5d59df3a8a..5cc1b85b54 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
@@ -420,7 +420,8 @@ public class SingleNodePlanner {
                 break;
             }
 
-            if (CollectionUtils.isNotEmpty(root.getConjuncts())) {
+            if (CollectionUtils.isNotEmpty(root.getConjuncts())
+                    || CollectionUtils.isNotEmpty(root.getProjectList())) {
                 break;
             }
 
diff --git 
a/regression-test/data/query_p0/sql_functions/aggregate_functions/test_aggregate_push_down_agg.out
 
b/regression-test/data/query_p0/sql_functions/aggregate_functions/test_aggregate_push_down_agg.out
new file mode 100644
index 0000000000..f88a155567
--- /dev/null
+++ 
b/regression-test/data/query_p0/sql_functions/aggregate_functions/test_aggregate_push_down_agg.out
@@ -0,0 +1,4 @@
+-- This file is automatically generated. You should know what you did if you 
want to edit this
+-- !sql --
+3
+
diff --git 
a/regression-test/suites/query_p0/sql_functions/aggregate_functions/test_aggregate_push_down_agg.groovy
 
b/regression-test/suites/query_p0/sql_functions/aggregate_functions/test_aggregate_push_down_agg.groovy
new file mode 100644
index 0000000000..443377f8e2
--- /dev/null
+++ 
b/regression-test/suites/query_p0/sql_functions/aggregate_functions/test_aggregate_push_down_agg.groovy
@@ -0,0 +1,44 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+suite("test_aggregate_push_down_agg") {
+    sql """ drop table if exists test_aggregate_push_down_agg; """
+    sql """
+        create table test_aggregate_push_down_agg (
+            k1 int,
+            tracking_number varchar(16)
+        ) duplicate key(k1)
+        distributed by hash(k1)
+        properties("replication_num"="1");
+    """
+    sql """ insert into test_aggregate_push_down_agg values(1, "aaa"), (1, 
"bbb"), (2, "ccc") """
+    sql 'set enable_nereids_planner=false'
+    qt_sql """
+        SELECT
+           count(*)
+        FROM
+           (
+               select
+                  case
+                     when tracking_number is null then ''
+                     else tracking_number
+                  end as tracking_number
+               from
+                  test_aggregate_push_down_agg
+           ) V_T;
+    """
+}


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

Reply via email to