You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by yi...@apache.org on 2022/12/30 07:37:02 UTC
[doris] branch master updated: [fix](index) fix that the last element of each batch will be read repeatedly for binary prefix page (#15481)
This is an automated email from the ASF dual-hosted git repository.
yiguolei 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 2f572ccc43 [fix](index) fix that the last element of each batch will be read repeatedly for binary prefix page (#15481)
2f572ccc43 is described below
commit 2f572ccc43a8f592308f3bf4b42e338c1cdcc3cc
Author: Xin Liao <li...@126.com>
AuthorDate: Fri Dec 30 15:36:55 2022 +0800
[fix](index) fix that the last element of each batch will be read repeatedly for binary prefix page (#15481)
---
.../olap/rowset/segment_v2/binary_prefix_page.cpp | 6 ++++--
.../rowset/segment_v2/binary_prefix_page_test.cpp | 24 ++++++++++++++++++++++
2 files changed, 28 insertions(+), 2 deletions(-)
diff --git a/be/src/olap/rowset/segment_v2/binary_prefix_page.cpp b/be/src/olap/rowset/segment_v2/binary_prefix_page.cpp
index 5b8d4d3090..a80d4e6620 100644
--- a/be/src/olap/rowset/segment_v2/binary_prefix_page.cpp
+++ b/be/src/olap/rowset/segment_v2/binary_prefix_page.cpp
@@ -257,21 +257,23 @@ Status BinaryPrefixPageDecoder::next_batch(size_t* n, ColumnBlockView* dst) {
RETURN_IF_ERROR(_copy_current_to_output(dst->pool(), out));
i++;
out++;
+ _cur_pos++;
// read and copy remaining values
for (; i < max_fetch; ++i) {
- _cur_pos++;
RETURN_IF_ERROR(_read_next_value_to_output(prev[i - 1], dst->pool(), out));
out++;
+ _cur_pos++;
}
//must update _current_value
_current_value.clear();
_current_value.assign_copy((uint8_t*)prev[i - 1].data, prev[i - 1].size);
+ _read_next_value();
*n = max_fetch;
return Status::OK();
}
} // namespace segment_v2
-} // namespace doris
\ No newline at end of file
+} // namespace doris
diff --git a/be/test/olap/rowset/segment_v2/binary_prefix_page_test.cpp b/be/test/olap/rowset/segment_v2/binary_prefix_page_test.cpp
index 66ad144cb1..6db57f19a7 100644
--- a/be/test/olap/rowset/segment_v2/binary_prefix_page_test.cpp
+++ b/be/test/olap/rowset/segment_v2/binary_prefix_page_test.cpp
@@ -90,6 +90,30 @@ public:
EXPECT_EQ(std::to_string(i), values[i - 1000].to_string());
}
+ ret = page_decoder->seek_to_position_in_page(0);
+ EXPECT_TRUE(ret.ok());
+ int n = 0;
+ while (true) {
+ //check values
+ MemPool pool;
+ auto type_info = get_scalar_type_info(OLAP_FIELD_TYPE_VARCHAR);
+ std::unique_ptr<ColumnVectorBatch> cvb;
+ size_t size = 6;
+ ColumnVectorBatch::create(size, false, type_info, nullptr, &cvb);
+ ColumnBlock column_block(cvb.get(), &pool);
+ ColumnBlockView block_view(&column_block);
+ ret = page_decoder->next_batch(&size, &block_view);
+ EXPECT_TRUE(ret.ok());
+ if (size == 0) {
+ break;
+ }
+ Slice* values = reinterpret_cast<Slice*>(column_block.data());
+ for (int i = 0; i < size; ++i) {
+ EXPECT_EQ(std::to_string(1000 + 6 * n + i), values[i].to_string());
+ }
+ n++;
+ }
+
std::unique_ptr<ColumnVectorBatch> cvb2;
ColumnVectorBatch::create(size, false, type_info, nullptr, &cvb2);
ColumnBlock column_block2(cvb2.get(), &pool);
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org