From 7e7729c4b020aec4f090516bbcb1b99e682f04e8 Mon Sep 17 00:00:00 2001 From: zhangstar333 <87313068+zhangstar333@users.noreply.github.com> Date: Tue, 13 Aug 2024 17:42:29 +0800 Subject: [PATCH] [cherry-pick](branch-21) fix partition-topn calculate partition input rows have error (#39100) (#39281) ## Proposed changes cherry-pick from master: #39100 --- be/src/pipeline/exec/partition_sort_sink_operator.cpp | 2 +- be/src/vec/exec/vpartition_sort_node.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/be/src/pipeline/exec/partition_sort_sink_operator.cpp b/be/src/pipeline/exec/partition_sort_sink_operator.cpp index f820914b33..cbc2e3ee2e 100644 --- a/be/src/pipeline/exec/partition_sort_sink_operator.cpp +++ b/be/src/pipeline/exec/partition_sort_sink_operator.cpp @@ -104,7 +104,6 @@ Status PartitionSortSinkOperatorX::sink(RuntimeState* state, vectorized::Block* SCOPED_TIMER(local_state.exec_time_counter()); if (current_rows > 0) { COUNTER_UPDATE(local_state.rows_input_counter(), (int64_t)input_block->rows()); - local_state.child_input_rows = local_state.child_input_rows + current_rows; if (UNLIKELY(_partition_exprs_num == 0)) { if (UNLIKELY(local_state._value_places.empty())) { local_state._value_places.push_back(_pool->add(new vectorized::PartitionBlocks( @@ -129,6 +128,7 @@ Status PartitionSortSinkOperatorX::sink(RuntimeState* state, vectorized::Block* RETURN_IF_ERROR(_split_block_by_partition(input_block, local_state, eos)); RETURN_IF_CANCELLED(state); input_block->clear_column_data(); + local_state.child_input_rows = local_state.child_input_rows + current_rows; } } } diff --git a/be/src/vec/exec/vpartition_sort_node.cpp b/be/src/vec/exec/vpartition_sort_node.cpp index 25aacde703..0c737a2def 100644 --- a/be/src/vec/exec/vpartition_sort_node.cpp +++ b/be/src/vec/exec/vpartition_sort_node.cpp @@ -228,7 +228,6 @@ Status VPartitionSortNode::sink(RuntimeState* state, vectorized::Block* input_bl SCOPED_TIMER(_exec_timer); auto current_rows = input_block->rows(); if (current_rows > 0) { - child_input_rows = child_input_rows + current_rows; if (UNLIKELY(_partition_exprs_num == 0)) { if (UNLIKELY(_value_places.empty())) { _value_places.push_back(_pool->add( @@ -250,6 +249,7 @@ Status VPartitionSortNode::sink(RuntimeState* state, vectorized::Block* input_bl RETURN_IF_ERROR(_split_block_by_partition(input_block, eos)); RETURN_IF_CANCELLED(state); input_block->clear_column_data(); + child_input_rows = child_input_rows + current_rows; } } }