This is an automated email from the ASF dual-hosted git repository.
zhangchen 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 95ae5376f3 [Fix](BinaryPrefixPage) stop to read values when current
pos reached the end of the page in `BinaryPrefixPageDecoder::next_batch`
(#23855)
95ae5376f3 is described below
commit 95ae5376f306177d2f92ad109548e7a1cfd6ae14
Author: bobhan1 <[email protected]>
AuthorDate: Wed Sep 6 16:34:38 2023 +0800
[Fix](BinaryPrefixPage) stop to read values when current pos reached the
end of the page in `BinaryPrefixPageDecoder::next_batch` (#23855)
---
be/src/olap/rowset/segment_v2/binary_prefix_page.cpp | 9 +++++++--
be/test/olap/primary_key_index_test.cpp | 2 +-
2 files changed, 8 insertions(+), 3 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 e3e893a0dd..ab9056def1 100644
--- a/be/src/olap/rowset/segment_v2/binary_prefix_page.cpp
+++ b/be/src/olap/rowset/segment_v2/binary_prefix_page.cpp
@@ -23,6 +23,7 @@
#include <algorithm>
#include <vector>
+#include "common/status.h"
#include "gutil/port.h"
#include "gutil/strings/substitute.h"
#include "util/coding.h"
@@ -114,12 +115,13 @@ const uint8_t*
BinaryPrefixPageDecoder::_decode_value_lengths(const uint8_t* ptr
Status BinaryPrefixPageDecoder::_read_next_value() {
if (_cur_pos >= _num_values) {
- return Status::NotFound("no more value to read");
+ return Status::EndOfFile("no more value to read");
}
uint32_t shared_len;
uint32_t non_shared_len;
auto data_ptr = _decode_value_lengths(_next_ptr, &shared_len,
&non_shared_len);
if (data_ptr == nullptr) {
+ DCHECK(false) << "[BinaryPrefixPageDecoder::_read_next_value]
corruption!";
return Status::Corruption("Failed to decode value at position {}",
_cur_pos);
}
_current_value.resize(shared_len);
@@ -215,8 +217,11 @@ Status BinaryPrefixPageDecoder::next_batch(size_t* n,
vectorized::MutableColumnP
// read and copy values
for (size_t i = 0; i < max_fetch; ++i) {
dst->insert_data((char*)(_current_value.data()),
_current_value.size());
- _read_next_value();
_cur_pos++;
+ // reach the end of the page, should not read the next value
+ if (_cur_pos < _num_values) {
+ RETURN_IF_ERROR(_read_next_value());
+ }
}
*n = max_fetch;
diff --git a/be/test/olap/primary_key_index_test.cpp
b/be/test/olap/primary_key_index_test.cpp
index 837d258700..46b87b712d 100644
--- a/be/test/olap/primary_key_index_test.cpp
+++ b/be/test/olap/primary_key_index_test.cpp
@@ -129,7 +129,7 @@ TEST_F(PrimaryKeyIndexTest, builder) {
EXPECT_FALSE(exists);
auto status = index_iterator->seek_at_or_after(&slice, &exact_match);
EXPECT_FALSE(exact_match);
- EXPECT_TRUE(status.is<NOT_FOUND>());
+ EXPECT_TRUE(status.is<ErrorCode::END_OF_FILE>());
}
// read all key
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]