mirror of https://github.com/milvus-io/milvus.git
enhance: Opt metric type does not match error message (#29927)
issue: #29791 /kind improvement Signed-off-by: xige-16 <xi.ge@zilliz.com> Signed-off-by: xige-16 <xi.ge@zilliz.com>pull/30083/head
parent
6fd432593c
commit
fa7cf587b0
|
@ -58,7 +58,9 @@ enum ErrorCode {
|
||||||
FieldNotLoaded = 2027,
|
FieldNotLoaded = 2027,
|
||||||
ExprInvalid = 2028,
|
ExprInvalid = 2028,
|
||||||
UnistdError = 2030,
|
UnistdError = 2030,
|
||||||
|
MetricTypeNotMatch = 2031,
|
||||||
KnowhereError = 2100,
|
KnowhereError = 2100,
|
||||||
|
|
||||||
};
|
};
|
||||||
namespace impl {
|
namespace impl {
|
||||||
void
|
void
|
||||||
|
|
|
@ -281,16 +281,7 @@ class SegmentGrowingImpl : public SegmentGrowing {
|
||||||
void
|
void
|
||||||
check_search(const query::Plan* plan) const override {
|
check_search(const query::Plan* plan) const override {
|
||||||
Assert(plan);
|
Assert(plan);
|
||||||
auto& metric_str = plan->plan_node_->search_info_.metric_type_;
|
check_metric_type(plan, index_meta_);
|
||||||
auto searched_field_id = plan->plan_node_->search_info_.field_id_;
|
|
||||||
auto index_meta =
|
|
||||||
index_meta_->GetFieldIndexMeta(FieldId(searched_field_id));
|
|
||||||
if (metric_str.empty()) {
|
|
||||||
metric_str = index_meta.GeMetricType();
|
|
||||||
} else {
|
|
||||||
AssertInfo(metric_str == index_meta.GeMetricType(),
|
|
||||||
"metric type not match");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const ConcurrentVector<Timestamp>&
|
const ConcurrentVector<Timestamp>&
|
||||||
|
|
|
@ -316,4 +316,23 @@ SegmentInternalInterface::LoadStringSkipIndex(
|
||||||
skipIndex_.LoadString(field_id, chunk_id, var_column);
|
skipIndex_.LoadString(field_id, chunk_id, var_column);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
SegmentInternalInterface::check_metric_type(
|
||||||
|
const query::Plan* plan, const IndexMetaPtr index_meta) const {
|
||||||
|
auto& metric_str = plan->plan_node_->search_info_.metric_type_;
|
||||||
|
auto searched_field_id = plan->plan_node_->search_info_.field_id_;
|
||||||
|
auto field_index_meta =
|
||||||
|
index_meta->GetFieldIndexMeta(FieldId(searched_field_id));
|
||||||
|
if (metric_str.empty()) {
|
||||||
|
metric_str = field_index_meta.GeMetricType();
|
||||||
|
}
|
||||||
|
if (metric_str != field_index_meta.GeMetricType()) {
|
||||||
|
throw SegcoreError(
|
||||||
|
MetricTypeNotMatch,
|
||||||
|
fmt::format("metric type not match, expected {}, actual {}.",
|
||||||
|
field_index_meta.GeMetricType(),
|
||||||
|
metric_str));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace milvus::segcore
|
} // namespace milvus::segcore
|
||||||
|
|
|
@ -231,6 +231,10 @@ class SegmentInternalInterface : public SegmentInterface {
|
||||||
virtual std::pair<std::unique_ptr<IdArray>, std::vector<SegOffset>>
|
virtual std::pair<std::unique_ptr<IdArray>, std::vector<SegOffset>>
|
||||||
search_ids(const IdArray& id_array, Timestamp timestamp) const = 0;
|
search_ids(const IdArray& id_array, Timestamp timestamp) const = 0;
|
||||||
|
|
||||||
|
void
|
||||||
|
check_metric_type(const query::Plan* plan,
|
||||||
|
const IndexMetaPtr index_meta) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Apply timestamp filtering on bitset, the query can't see an entity whose
|
* Apply timestamp filtering on bitset, the query can't see an entity whose
|
||||||
* timestamp is bigger than the timestamp of query.
|
* timestamp is bigger than the timestamp of query.
|
||||||
|
|
|
@ -921,16 +921,7 @@ SegmentSealedImpl::check_search(const query::Plan* plan) const {
|
||||||
AssertInfo(plan->extra_info_opt_.has_value(),
|
AssertInfo(plan->extra_info_opt_.has_value(),
|
||||||
"Extra info of search plan doesn't have value");
|
"Extra info of search plan doesn't have value");
|
||||||
|
|
||||||
auto& metric_str = plan->plan_node_->search_info_.metric_type_;
|
check_metric_type(plan, col_index_meta_);
|
||||||
auto searched_field_id = plan->plan_node_->search_info_.field_id_;
|
|
||||||
auto index_meta =
|
|
||||||
col_index_meta_->GetFieldIndexMeta(FieldId(searched_field_id));
|
|
||||||
if (metric_str.empty()) {
|
|
||||||
metric_str = index_meta.GeMetricType();
|
|
||||||
} else {
|
|
||||||
AssertInfo(metric_str == index_meta.GeMetricType(),
|
|
||||||
"metric type not match");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!is_system_field_ready()) {
|
if (!is_system_field_ready()) {
|
||||||
PanicInfo(
|
PanicInfo(
|
||||||
|
|
Loading…
Reference in New Issue