mirror of https://github.com/milvus-io/milvus.git
Reduce copy while retrieving primary keys (#26616)
Signed-off-by: yah01 <yang.cen@zilliz.com>pull/27151/head
parent
c3f15c6b95
commit
3203ce1654
|
@ -513,7 +513,8 @@ SegmentGrowingImpl::search_ids(const IdArray& id_array,
|
|||
|
||||
auto res_id_arr = std::make_unique<IdArray>();
|
||||
std::vector<SegOffset> res_offsets;
|
||||
for (auto pk : pks) {
|
||||
res_offsets.reserve(pks.size());
|
||||
for (auto& pk : pks) {
|
||||
auto segOffsets = insert_record_.search_pk(pk, timestamp);
|
||||
for (auto offset : segOffsets) {
|
||||
switch (data_type) {
|
||||
|
@ -524,7 +525,7 @@ SegmentGrowingImpl::search_ids(const IdArray& id_array,
|
|||
}
|
||||
case DataType::VARCHAR: {
|
||||
res_id_arr->mutable_str_id()->add_data(
|
||||
std::get<std::string>(pk));
|
||||
std::get<std::string>(std::move(pk)));
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
|
|
|
@ -956,7 +956,8 @@ SegmentSealedImpl::search_ids(const IdArray& id_array,
|
|||
|
||||
auto res_id_arr = std::make_unique<IdArray>();
|
||||
std::vector<SegOffset> res_offsets;
|
||||
for (auto pk : pks) {
|
||||
res_offsets.reserve(pks.size());
|
||||
for (auto& pk : pks) {
|
||||
auto segOffsets = insert_record_.search_pk(pk, timestamp);
|
||||
for (auto offset : segOffsets) {
|
||||
switch (data_type) {
|
||||
|
@ -967,7 +968,7 @@ SegmentSealedImpl::search_ids(const IdArray& id_array,
|
|||
}
|
||||
case DataType::VARCHAR: {
|
||||
res_id_arr->mutable_str_id()->add_data(
|
||||
std::get<std::string>(pk));
|
||||
std::get<std::string>(std::move(pk)));
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
|
|
Loading…
Reference in New Issue