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

yiguolei pushed a commit to branch branch-2.1
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-2.1 by this push:
     new 425c00a0d1a [fix](agg) incorrect result with having conjuncts and 
limit (#33040)
425c00a0d1a is described below

commit 425c00a0d1a2e651d84d2fd5911b544c369e6ca8
Author: Jerry Hu <mrh...@gmail.com>
AuthorDate: Sat Mar 30 10:13:51 2024 +0800

    [fix](agg) incorrect result with having conjuncts and limit (#33040)
---
 be/src/pipeline/exec/aggregation_sink_operator.cpp           | 3 ++-
 regression-test/data/nereids_p0/aggregate/aggregate.out      | 2 ++
 regression-test/suites/nereids_p0/aggregate/aggregate.groovy | 6 ++++++
 3 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/be/src/pipeline/exec/aggregation_sink_operator.cpp 
b/be/src/pipeline/exec/aggregation_sink_operator.cpp
index 64c946e6daa..6e0042da7d2 100644
--- a/be/src/pipeline/exec/aggregation_sink_operator.cpp
+++ b/be/src/pipeline/exec/aggregation_sink_operator.cpp
@@ -631,7 +631,8 @@ AggSinkOperatorX::AggSinkOperatorX(ObjectPool* pool, int 
operator_id, const TPla
           _is_first_phase(tnode.agg_node.__isset.is_first_phase && 
tnode.agg_node.is_first_phase),
           _pool(pool),
           _limit(tnode.limit),
-          _have_conjuncts(tnode.__isset.vconjunct && 
!tnode.vconjunct.nodes.empty()),
+          _have_conjuncts((tnode.__isset.vconjunct && 
!tnode.vconjunct.nodes.empty()) ||
+                          (tnode.__isset.conjuncts && 
!tnode.conjuncts.empty())),
           _partition_exprs(tnode.__isset.distribute_expr_lists ? 
tnode.distribute_expr_lists[0]
                                                                : 
std::vector<TExpr> {}),
           _is_colocate(tnode.agg_node.__isset.is_colocate && 
tnode.agg_node.is_colocate) {}
diff --git a/regression-test/data/nereids_p0/aggregate/aggregate.out 
b/regression-test/data/nereids_p0/aggregate/aggregate.out
index 584fc855e0b..f81a14f0ce0 100644
--- a/regression-test/data/nereids_p0/aggregate/aggregate.out
+++ b/regression-test/data/nereids_p0/aggregate/aggregate.out
@@ -377,3 +377,5 @@ TESTING     AGAIN
 -- !select_quantile_percent --
 5000.0
 
+-- !having_with_limit --
+7      -32767.0
diff --git a/regression-test/suites/nereids_p0/aggregate/aggregate.groovy 
b/regression-test/suites/nereids_p0/aggregate/aggregate.groovy
index 2446fcf0923..760333f3e78 100644
--- a/regression-test/suites/nereids_p0/aggregate/aggregate.groovy
+++ b/regression-test/suites/nereids_p0/aggregate/aggregate.groovy
@@ -343,4 +343,10 @@ suite("aggregate") {
             """
         exception "aggregate function cannot contain aggregate parameters"
     }
+
+    sql " set parallel_pipeline_task_num = 1; "
+    sql " set enable_pipeline_x_engine = 1; "
+    qt_having_with_limit """
+        select k1 as k, avg(k2) as k2  from tempbaseall group by k1 having k2 
< -32765 limit 1;
+    """
 }


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

Reply via email to