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 43aaa7b6aec branch-4.0: [Bug](scan) fix topn_next fail #57895 (#58056)
43aaa7b6aec is described below
commit 43aaa7b6aec9a9a1a2342cb856c63ab7dc3a69fc
Author: github-actions[bot]
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Sat Nov 15 21:10:18 2025 +0800
branch-4.0: [Bug](scan) fix topn_next fail #57895 (#58056)
Cherry-picked from #57895
Co-authored-by: Pxl <[email protected]>
---
be/src/vec/olap/vgeneric_iterators.cpp | 14 +++++++++-----
be/src/vec/olap/vgeneric_iterators.h | 7 ++++++-
2 files changed, 15 insertions(+), 6 deletions(-)
diff --git a/be/src/vec/olap/vgeneric_iterators.cpp
b/be/src/vec/olap/vgeneric_iterators.cpp
index 1c3ec2161e5..314c1f0acbb 100644
--- a/be/src/vec/olap/vgeneric_iterators.cpp
+++ b/be/src/vec/olap/vgeneric_iterators.cpp
@@ -134,10 +134,9 @@ bool VMergeIteratorContext::compare(const
VMergeIteratorContext& rhs) const {
return result;
}
-// `advanced = false` when current block finished
-Status VMergeIteratorContext::copy_rows(BlockWithSameBit* block_with_same_bit,
bool advanced) {
+Status VMergeIteratorContext::copy_rows(Block* block, bool advanced) {
Block& src = *_block;
- Block& dst = *block_with_same_bit->block;
+ Block& dst = *block;
if (_cur_batch_num == 0) {
return Status::OK();
}
@@ -156,12 +155,17 @@ Status VMergeIteratorContext::copy_rows(BlockWithSameBit*
block_with_same_bit, b
d_cp->assume_mutable()->insert_range_from(*s_cp, start,
_cur_batch_num);
}
});
+ _cur_batch_num = 0;
+ return Status::OK();
+}
+
+// `advanced = false` when current block finished
+Status VMergeIteratorContext::copy_rows(BlockWithSameBit* block_with_same_bit,
bool advanced) {
const auto& tmp_pre_ctx_same_bit = get_pre_ctx_same();
block_with_same_bit->same_bit.insert(block_with_same_bit->same_bit.end(),
tmp_pre_ctx_same_bit.begin(),
tmp_pre_ctx_same_bit.begin() +
_cur_batch_num);
- _cur_batch_num = 0;
- return Status::OK();
+ return copy_rows(block_with_same_bit->block, advanced);
}
Status VMergeIteratorContext::copy_rows(BlockView* view, bool advanced) {
diff --git a/be/src/vec/olap/vgeneric_iterators.h
b/be/src/vec/olap/vgeneric_iterators.h
index beb677e27c0..c48492aa702 100644
--- a/be/src/vec/olap/vgeneric_iterators.h
+++ b/be/src/vec/olap/vgeneric_iterators.h
@@ -110,8 +110,11 @@ public:
bool compare(const VMergeIteratorContext& rhs) const;
// `advanced = false` when current block finished
+ // when input argument type is block, we do not process same_bit,
+ // this case we only need merge and return ordered data
(VCollectIterator::_topn_next), data mode is dup/mow can guarantee all rows are
different
+ // todo: we can reduce same_bit processing in this case to improve
performance
+ Status copy_rows(Block* block, bool advanced = true);
Status copy_rows(BlockWithSameBit* block, bool advanced = true);
-
Status copy_rows(BlockView* view, bool advanced = true);
RowLocation current_row_location() {
@@ -200,6 +203,7 @@ public:
Status init(const StorageReadOptions& opts) override;
+ Status next_batch(Block* block) override { return _next_batch(block); }
Status next_batch(BlockWithSameBit* block_with_same_bit) override {
return _next_batch(block_with_same_bit);
}
@@ -224,6 +228,7 @@ private:
return cast_set<int>(block_with_same_bit->block->rows());
}
int _get_size(BlockView* block_view) { return
cast_set<int>(block_view->size()); }
+ int _get_size(Block* block) { return cast_set<int>(block->rows()); }
template <typename T>
Status _next_batch(T* block) {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]