[fix](agg) incorrect result with having conjuncts and limit (#33040)

This commit is contained in:
Jerry Hu
2024-03-30 10:13:51 +08:00
committed by yiguolei
parent db3179edaf
commit 425c00a0d1
3 changed files with 10 additions and 1 deletions

View File

@ -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) {}

View File

@ -377,3 +377,5 @@ TESTING AGAIN
-- !select_quantile_percent --
5000.0
-- !having_with_limit --
7 -32767.0

View File

@ -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;
"""
}