Skip to content

Commit

Permalink
fix: Fix using wrong upperbound when searching by pk (#37769)
Browse files Browse the repository at this point in the history
issue: #37649

Signed-off-by: sunby <sunbingyi1992@gmail.com>
  • Loading branch information
sunby authored Nov 19, 2024
1 parent fceff6e commit 6b82320
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
5 changes: 2 additions & 3 deletions internal/core/src/segcore/ChunkedSegmentSealedImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1239,8 +1239,7 @@ ChunkedSegmentSealedImpl::search_sorted_pk(const PkType& pk,
return elem < value;
});
auto num_rows_until_chunk = pk_column->GetNumRowsUntilChunk(i);
for (; it != src + pk_column->NumRows() && *it == target;
++it) {
for (; it != src + chunk_row_num && *it == target; ++it) {
auto offset = it - src + num_rows_until_chunk;
if (condition(offset)) {
pk_offsets.emplace_back(offset);
Expand All @@ -1264,7 +1263,7 @@ ChunkedSegmentSealedImpl::search_sorted_pk(const PkType& pk,
auto string_chunk = std::dynamic_pointer_cast<StringChunk>(
var_column->GetChunk(i));
auto offset = string_chunk->binary_search_string(target);
for (; offset != -1 && offset < var_column->NumRows() &&
for (; offset != -1 && offset < string_chunk->RowNums() &&
var_column->RawAt(offset) == target;
++offset) {
auto segment_offset = offset + num_rows_until_chunk;
Expand Down
2 changes: 1 addition & 1 deletion internal/core/unittest/test_chunked_segment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ class TestChunkSegment : public testing::Test {
-1,
segcore::SegcoreConfig::default_config(),
false,
false,
true,
true);
test_data_count = 10000;

Expand Down

0 comments on commit 6b82320

Please sign in to comment.