fix: Skip erase field if index build on PK field (#39370)

Related to #39339

---------

Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>
pull/39411/head
congqixia 2025-01-17 20:31:02 +08:00 committed by GitHub
parent c22e457c59
commit 7cac87caca
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 2 deletions

View File

@ -229,8 +229,10 @@ ChunkedSegmentSealedImpl::LoadScalarIndex(const LoadIndexInfo& info) {
set_bit(index_ready_bitset_, field_id, true);
update_row_count(row_count);
// release field column if the index contains raw data
// only release non-primary field when in pk sorted mode
if (scalar_indexings_[field_id]->HasRawData() &&
get_bit(field_data_ready_bitset_, field_id)) {
get_bit(field_data_ready_bitset_, field_id) &&
(schema_->get_primary_field_id() != field_id || !is_sorted_by_pk_)) {
fields_.erase(field_id);
set_bit(field_data_ready_bitset_, field_id, false);
}

View File

@ -266,8 +266,10 @@ SegmentSealedImpl::LoadScalarIndex(const LoadIndexInfo& info) {
set_bit(index_ready_bitset_, field_id, true);
update_row_count(row_count);
// release field column if the index contains raw data
// only release non-primary field
if (scalar_indexings_[field_id]->HasRawData() &&
get_bit(field_data_ready_bitset_, field_id)) {
get_bit(field_data_ready_bitset_, field_id) &&
(schema_->get_primary_field_id() != field_id || !is_sorted_by_pk_)) {
fields_.erase(field_id);
set_bit(field_data_ready_bitset_, field_id, false);
}