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

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


The following commit(s) were added to refs/heads/branch-4.0 by this push:
     new 2fae65f6089 branch-4.0: [Bug](distinct) Fixes off-by-one error in 
aggregation limit check #60828 (#60868)
2fae65f6089 is described below

commit 2fae65f60892174adfd3eeef68c996fb613d7abd
Author: github-actions[bot] 
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Fri Feb 27 16:29:20 2026 +0800

    branch-4.0: [Bug](distinct) Fixes off-by-one error in aggregation limit 
check #60828 (#60868)
    
    Cherry-picked from #60828
    
    Co-authored-by: Pxl <[email protected]>
---
 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]

Reply via email to