Skip to content

Commit

Permalink
fix: Skip create primary key index when loading pk index (milvus-io#3…
Browse files Browse the repository at this point in the history
…9922)

issue: milvus-io#39907
pr: milvus-io#39921

Signed-off-by: sunby <[email protected]>
  • Loading branch information
sunby committed Feb 20, 2025
1 parent 8009af7 commit 8a8fe6d
Showing 1 changed file with 0 additions and 40 deletions.
40 changes: 0 additions & 40 deletions internal/core/src/segcore/ChunkedSegmentSealedImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -192,46 +192,6 @@ ChunkedSegmentSealedImpl::LoadScalarIndex(const LoadIndexInfo& info) {

scalar_indexings_[field_id] =
std::move(const_cast<LoadIndexInfo&>(info).index);
// reverse pk from scalar index and set pks to offset
if (schema_->get_primary_field_id() == field_id) {
AssertInfo(field_id.get() != -1, "Primary key is -1");
switch (field_meta.get_data_type()) {
case DataType::INT64: {
auto int64_index = dynamic_cast<index::ScalarIndex<int64_t>*>(
scalar_indexings_[field_id].get());
if (!is_sorted_by_pk_ && insert_record_.empty_pks() &&
int64_index->HasRawData()) {
for (int i = 0; i < row_count; ++i) {
auto raw = int64_index->Reverse_Lookup(i);
AssertInfo(raw.has_value(), "pk not found");
insert_record_.insert_pk(raw.value(), i);
}
insert_record_.seal_pks();
}
break;
}
case DataType::VARCHAR: {
auto string_index =
dynamic_cast<index::ScalarIndex<std::string>*>(
scalar_indexings_[field_id].get());
if (!is_sorted_by_pk_ && insert_record_.empty_pks() &&
string_index->HasRawData()) {
for (int i = 0; i < row_count; ++i) {
auto raw = string_index->Reverse_Lookup(i);
AssertInfo(raw.has_value(), "pk not found");
insert_record_.insert_pk(raw.value(), i);
}
insert_record_.seal_pks();
}
break;
}
default: {
PanicInfo(DataTypeInvalid,
fmt::format("unsupported primary key type {}",
field_meta.get_data_type()));
}
}
}

set_bit(index_ready_bitset_, field_id, true);
update_row_count(row_count);
Expand Down

0 comments on commit 8a8fe6d

Please sign in to comment.