enhance: Opt vector dimension mismatch error message (#29928)

issue: https://github.com/milvus-io/milvus/issues/29791
/kind improvement

Signed-off-by: xige-16 <xi.ge@zilliz.com>

---------

Signed-off-by: xige-16 <xi.ge@zilliz.com>
This commit is contained in:
xige-16 2024-01-19 17:52:54 +08:00 committed by GitHub
parent 0d356b0545
commit aee19dcd6b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 2 deletions

View File

@ -59,6 +59,7 @@ enum ErrorCode {
ExprInvalid = 2028,
UnistdError = 2030,
MetricTypeNotMatch = 2031,
DimNotMatch = 2032,
KnowhereError = 2100,
};

View File

@ -49,8 +49,14 @@ ParsePlaceholderGroup(const Plan* plan,
AssertInfo(element.num_of_queries_, "must have queries");
Assert(element.num_of_queries_ > 0);
element.line_sizeof_ = info.values().Get(0).size();
AssertInfo(field_meta.get_sizeof() == element.line_sizeof_,
"vector dimension mismatch");
if (field_meta.get_sizeof() != element.line_sizeof_) {
throw SegcoreError(
DimNotMatch,
fmt::format("vector dimension mismatch, expected vector "
"size(byte) {}, actual {}.",
field_meta.get_sizeof(),
element.line_sizeof_));
}
auto& target = element.blob_;
target.reserve(element.line_sizeof_ * element.num_of_queries_);
for (auto& line : info.values()) {