enhance: [Cherry-pick] Opt vector dimension mismatch error message (#30316)

Cherry-pick from master
pr: https://github.com/milvus-io/milvus/pull/29928

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-29 14:47:03 +08:00 committed by GitHub
parent 5ec13ecc76
commit 9ab2ce0767
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 2 deletions

View File

@ -58,6 +58,7 @@ enum ErrorCode {
FieldNotLoaded = 2027,
ExprInvalid = 2028,
UnistdError = 2030,
DimNotMatch = 2032,
KnowhereError = 2100,
};
namespace impl {

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()) {