fix: Fix using wrong upperbound when searching by pk (#37769)

issue: https://github.com/milvus-io/milvus/issues/37649

Signed-off-by: sunby <sunbingyi1992@gmail.com>
pull/37794/head
Bingyi Sun 2024-11-19 10:16:31 +08:00 committed by GitHub
parent fceff6ed7f
commit 6b82320953
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 4 deletions

View File

@ -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);
@ -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;

View File

@ -180,7 +180,7 @@ class TestChunkSegment : public testing::Test {
-1,
segcore::SegcoreConfig::default_config(),
false,
false,
true,
true);
test_data_count = 10000;