diff --git a/internal/core/src/segcore/ChunkedSegmentSealedImpl.cpp b/internal/core/src/segcore/ChunkedSegmentSealedImpl.cpp index 3a6f660844a8a..938bbdabcc2ee 100644 --- a/internal/core/src/segcore/ChunkedSegmentSealedImpl.cpp +++ b/internal/core/src/segcore/ChunkedSegmentSealedImpl.cpp @@ -1230,8 +1230,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); @@ -1255,7 +1254,7 @@ ChunkedSegmentSealedImpl::search_sorted_pk(const PkType& pk, auto string_chunk = std::dynamic_pointer_cast( 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; diff --git a/internal/core/unittest/test_chunked_segment.cpp b/internal/core/unittest/test_chunked_segment.cpp index 0995dfb842433..1fc41fffc1c32 100644 --- a/internal/core/unittest/test_chunked_segment.cpp +++ b/internal/core/unittest/test_chunked_segment.cpp @@ -177,7 +177,7 @@ class TestChunkSegment : public testing::Test { -1, segcore::SegcoreConfig::default_config(), false, - false, + true, true); test_data_count = 10000;