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 23734561b3b [fix](Topn) Fixed partition_topn may be miss one row of 
data.  (#41352)
23734561b3b is described below

commit 23734561b3b33008ab20eb61d9b9fe52f15cbf75
Author: Mryange <[email protected]>
AuthorDate: Fri Sep 27 17:20:57 2024 +0800

    [fix](Topn) Fixed partition_topn may be miss one row of data.  (#41352)
    
    Fixed partition_topn may be miss one row of data
---
 be/src/pipeline/exec/partition_sort_sink_operator.cpp | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/be/src/pipeline/exec/partition_sort_sink_operator.cpp 
b/be/src/pipeline/exec/partition_sort_sink_operator.cpp
index 3a850a40b13..fbabdbdc8f8 100644
--- a/be/src/pipeline/exec/partition_sort_sink_operator.cpp
+++ b/be/src/pipeline/exec/partition_sort_sink_operator.cpp
@@ -298,14 +298,16 @@ Status 
PartitionSortSinkOperatorX::_emplace_into_hash_table(
                             SCOPED_TIMER(local_state._selector_block_timer);
                             
RETURN_IF_ERROR(place->append_block_by_selector(input_block, eos));
                         }
-                        if (local_state._is_need_passthrough) {
+                        //Perform passthrough for the range [0, row] of 
input_block
+                        if (local_state._is_need_passthrough && row >= 0) {
                             {
                                 
COUNTER_UPDATE(local_state._passthrough_rows_counter,
-                                               (int64_t)(num_rows - row));
+                                               (int64_t)(row + 1));
                                 std::lock_guard<std::mutex> lock(
                                         
local_state._shared_state->buffer_mutex);
                                 // have emplace (num_rows - row) to hashtable, 
and now have row remaining needed in block;
-                                input_block->set_num_rows(row);
+                                // set_num_rows(x) retains the range [0, x - 
1], so row + 1 is needed here.
+                                input_block->set_num_rows(row + 1);
                                 local_state._shared_state->blocks_buffer.push(
                                         std::move(*input_block));
                                 // buffer have data, source could read this.


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to