diff --git a/be/src/olap/delete_bitmap_calculator.cpp b/be/src/olap/delete_bitmap_calculator.cpp index bfdb506c066e6b..a370f0c06bf8e7 100644 --- a/be/src/olap/delete_bitmap_calculator.cpp +++ b/be/src/olap/delete_bitmap_calculator.cpp @@ -17,6 +17,7 @@ #include "olap/delete_bitmap_calculator.h" +#include "common/status.h" #include "olap/primary_key_index.h" #include "vec/data_types/data_type_factory.hpp" 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 ab9056def1b9b3..183e7bb0853440 100644 --- a/be/src/olap/rowset/segment_v2/binary_prefix_page.cpp +++ b/be/src/olap/rowset/segment_v2/binary_prefix_page.cpp @@ -202,7 +202,13 @@ Status BinaryPrefixPageDecoder::seek_at_or_after_value(const void* value, bool* return Status::OK(); } _cur_pos++; - RETURN_IF_ERROR(_read_next_value()); + auto st = _read_next_value(); + if (st.is()) { + return Status::Error("all value small than the value"); + } + if (!st.ok()) { + return st; + } } } diff --git a/be/src/olap/rowset/segment_v2/segment.cpp b/be/src/olap/rowset/segment_v2/segment.cpp index 7eb660b3c26a7d..3c565a0d014807 100644 --- a/be/src/olap/rowset/segment_v2/segment.cpp +++ b/be/src/olap/rowset/segment_v2/segment.cpp @@ -357,8 +357,11 @@ Status Segment::lookup_row_key(const Slice& key, bool with_seq_col, RowLocation* bool exact_match = false; std::unique_ptr index_iterator; RETURN_IF_ERROR(_pk_index_reader->new_iterator(&index_iterator)); - RETURN_IF_ERROR(index_iterator->seek_at_or_after(&key_without_seq, &exact_match)); - if (!has_seq_col && !exact_match) { + auto st = index_iterator->seek_at_or_after(&key_without_seq, &exact_match); + if (!st.ok() && !st.is()) { + return st; + } + if (st.is() || (!has_seq_col && !exact_match)) { return Status::Error("Can't find key in the segment"); } row_location->row_id = index_iterator->get_current_ordinal(); diff --git a/be/src/olap/tablet.cpp b/be/src/olap/tablet.cpp index 7c737e4d3c0118..2ef732f2b49bc0 100644 --- a/be/src/olap/tablet.cpp +++ b/be/src/olap/tablet.cpp @@ -2835,7 +2835,7 @@ Status Tablet::lookup_row_key(const Slice& encoded_key, bool with_seq_col, for (auto id : picked_segments) { Status s = segments[id]->lookup_row_key(encoded_key, with_seq_col, &loc); - if (s.is() || s.is()) { + if (s.is()) { continue; } if (!s.ok() && !s.is()) { diff --git a/be/test/olap/primary_key_index_test.cpp b/be/test/olap/primary_key_index_test.cpp index 46b87b712da23f..42abaeadb1f555 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()); + EXPECT_TRUE(status.is()); } // read all key