From 81c101bc4a4662c9e406841331ff69eab5f05956 Mon Sep 17 00:00:00 2001 From: sunby Date: Mon, 4 Nov 2024 14:44:19 +0800 Subject: [PATCH] fix Signed-off-by: sunby --- internal/core/src/segcore/ChunkedSegmentSealedImpl.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/internal/core/src/segcore/ChunkedSegmentSealedImpl.cpp b/internal/core/src/segcore/ChunkedSegmentSealedImpl.cpp index 4ba2ca25bfc73..657a7fd69862c 100644 --- a/internal/core/src/segcore/ChunkedSegmentSealedImpl.cpp +++ b/internal/core/src/segcore/ChunkedSegmentSealedImpl.cpp @@ -1269,8 +1269,9 @@ ChunkedSegmentSealedImpl::search_pk(const PkType& pk, [](const int64_t& elem, const int64_t& value) { return elem < value; }); + auto num_rows_until_chunk = pk_column->GetNumRowsUntilChunk(i); for (; it != src + chunk_row_num && *it == target; it++) { - auto offset = it - src; + auto offset = it - src + num_rows_until_chunk; if (offset < insert_barrier) { pk_offsets.emplace_back(offset); } @@ -1290,8 +1291,10 @@ ChunkedSegmentSealedImpl::search_pk(const PkType& pk, for (int i = 0; i < num_chunk; ++i) { auto views = var_column->StringViews(i).first; auto it = std::lower_bound(views.begin(), views.end(), target); + auto num_rows_until_chunk = pk_column->GetNumRowsUntilChunk(i); for (; it != views.end() && *it == target; it++) { - auto offset = std::distance(views.begin(), it); + auto offset = + std::distance(views.begin(), it) + num_rows_until_chunk; if (offset < insert_barrier) { pk_offsets.emplace_back(offset); }