Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions be/src/olap/rowset/segment_v2/binary_prefix_page.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion be/test/olap/primary_key_index_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down