mirror of
https://gitee.com/milvus-io/milvus.git
synced 2025-12-06 09:08:43 +08:00
fix: Skip loading primary key if index has raw data (#39921)
issue: https://github.com/milvus-io/milvus/issues/39907 Signed-off-by: sunby <sunbingyi1992@gmail.com>
This commit is contained in:
parent
7fbeb5624e
commit
37b118d55d
@ -201,46 +201,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);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user