This is an automated email from the ASF dual-hosted git repository.
panxiaolei 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 ba816e78acc [Bug](distinct) Fixes off-by-one error in aggregation
limit check (#60828)
ba816e78acc is described below
commit ba816e78acc3b95fb64296ddc4f56057bcba2e37
Author: Pxl <[email protected]>
AuthorDate: Fri Feb 27 11:37:56 2026 +0800
[Bug](distinct) Fixes off-by-one error in aggregation limit check (#60828)
Updates limit condition to ensure exactly the specified number of rows
are returned. Prevents exceeding the row limit when the aggregated block
reaches or equals the threshold.
---
be/src/pipeline/exec/distinct_streaming_aggregation_operator.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/be/src/pipeline/exec/distinct_streaming_aggregation_operator.cpp
b/be/src/pipeline/exec/distinct_streaming_aggregation_operator.cpp
index 9cafe75ec76..972fc9ba923 100644
--- a/be/src/pipeline/exec/distinct_streaming_aggregation_operator.cpp
+++ b/be/src/pipeline/exec/distinct_streaming_aggregation_operator.cpp
@@ -378,9 +378,9 @@ Status DistinctStreamingAggOperatorX::push(RuntimeState*
state, vectorized::Bloc
RETURN_IF_ERROR(local_state._distinct_pre_agg_with_serialized_key(
in_block, local_state._aggregated_block.get()));
- // set limit and reach limit
+ // Prevents exceeding the row limit when the aggregated block reaches or
equals the threshold.
if (_limit != -1 &&
- (local_state._num_rows_returned +
local_state._aggregated_block->rows()) > _limit) {
+ (local_state._num_rows_returned +
local_state._aggregated_block->rows()) >= _limit) {
auto limit_rows = _limit - local_state._num_rows_returned;
local_state._aggregated_block->set_num_rows(limit_rows);
local_state._reach_limit = true;
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]