mirror of
https://gitee.com/milvus-io/milvus.git
synced 2026-01-07 19:31:51 +08:00
fix: Add explicit move semantics to get_batch_view interface (#42402)
pr: #42403 Signed-off-by: luzhang <luzhang@zilliz.com> Co-authored-by: luzhang <luzhang@zilliz.com>
This commit is contained in:
parent
ad8067f76e
commit
bc5be6380d
@ -86,13 +86,8 @@ struct UnaryElementFunc {
|
||||
|
||||
// This is the original code, which is kept for the documentation purposes
|
||||
// also, for iterative filter
|
||||
if constexpr (filter_type == FilterType::random ||
|
||||
std::is_same_v<T, std::string_view> ||
|
||||
std::is_same_v<T, std::string>) {
|
||||
if constexpr (filter_type == FilterType::random) {
|
||||
for (int i = 0; i < size; ++i) {
|
||||
if (has_bitmap_input && !bitmap_input[i + start_cursor]) {
|
||||
continue;
|
||||
}
|
||||
auto offset = (offsets != nullptr) ? offsets[i] : i;
|
||||
if constexpr (op == proto::plan::OpType::Equal) {
|
||||
res[i] = src[offset] == val;
|
||||
@ -111,15 +106,61 @@ struct UnaryElementFunc {
|
||||
op == proto::plan::OpType::InnerMatch) {
|
||||
res[i] = milvus::query::Match(src[offset], val, op);
|
||||
} else {
|
||||
PanicInfo(
|
||||
OpTypeInvalid,
|
||||
fmt::format(
|
||||
"unsupported op_type:{} for UnaryElementFunc", op));
|
||||
PanicInfo(OpTypeInvalid,
|
||||
"unsupported op_type:{} for UnaryElementFunc",
|
||||
op);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (has_bitmap_input) {
|
||||
if constexpr (std::is_same_v<T, std::string_view> ||
|
||||
std::is_same_v<T, std::string>) {
|
||||
for (int i = 0; i < size; ++i) {
|
||||
if (!bitmap_input[i + start_cursor]) {
|
||||
continue;
|
||||
}
|
||||
if constexpr (op == proto::plan::OpType::Equal) {
|
||||
res[i] = src[i] == val;
|
||||
} else if constexpr (op == proto::plan::OpType::NotEqual) {
|
||||
res[i] = src[i] != val;
|
||||
} else if constexpr (op ==
|
||||
proto::plan::OpType::GreaterThan) {
|
||||
res[i] = src[i] > val;
|
||||
} else if constexpr (op == proto::plan::OpType::LessThan) {
|
||||
res[i] = src[i] < val;
|
||||
} else if constexpr (op ==
|
||||
proto::plan::OpType::GreaterEqual) {
|
||||
res[i] = src[i] >= val;
|
||||
} else if constexpr (op == proto::plan::OpType::LessEqual) {
|
||||
res[i] = src[i] <= val;
|
||||
} else if constexpr (op ==
|
||||
proto::plan::OpType::PrefixMatch ||
|
||||
op == proto::plan::OpType::
|
||||
PostfixMatch ||
|
||||
op ==
|
||||
proto::plan::OpType::InnerMatch) {
|
||||
res[i] = milvus::query::Match(src[i], val, op);
|
||||
} else {
|
||||
PanicInfo(OpTypeInvalid,
|
||||
"unsupported op_type:{} for UnaryElementFunc",
|
||||
op);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if constexpr (op == proto::plan::OpType::PrefixMatch ||
|
||||
op == proto::plan::OpType::PostfixMatch ||
|
||||
op == proto::plan::OpType::InnerMatch) {
|
||||
for (int i = 0; i < size; ++i) {
|
||||
res[i] = milvus::query::Match(src[i], val, op);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if constexpr (op == proto::plan::OpType::Equal) {
|
||||
res.inplace_compare_val<T, milvus::bitset::CompareOpType::EQ>(
|
||||
src, size, val);
|
||||
@ -139,9 +180,9 @@ struct UnaryElementFunc {
|
||||
res.inplace_compare_val<T, milvus::bitset::CompareOpType::LE>(
|
||||
src, size, val);
|
||||
} else {
|
||||
PanicInfo(
|
||||
OpTypeInvalid,
|
||||
fmt::format("unsupported op_type:{} for UnaryElementFunc", op));
|
||||
PanicInfo(OpTypeInvalid,
|
||||
"unsupported op_type:{} for UnaryElementFunc",
|
||||
op);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@ -736,7 +736,7 @@ ChunkedSegmentSealedImpl::get_chunk_buffer(FieldId field_id,
|
||||
}
|
||||
return std::make_pair(
|
||||
field_data->GetBatchBuffer(chunk_id, start_offset, length),
|
||||
valid_data);
|
||||
std::move(valid_data));
|
||||
}
|
||||
PanicInfo(ErrorCode::UnexpectedError,
|
||||
"get_chunk_buffer only used for variable column field");
|
||||
|
||||
@ -213,7 +213,7 @@ class SegmentInternalInterface : public SegmentInterface {
|
||||
}
|
||||
}
|
||||
}
|
||||
return std::make_pair(res, chunk_info.second);
|
||||
return std::make_pair(std::move(res), std::move(chunk_info.second));
|
||||
}
|
||||
|
||||
template <typename ViewType>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user