diff --git a/internal/core/src/common/EasyAssert.h b/internal/core/src/common/EasyAssert.h index 4d84b45aea..0182e256e5 100644 --- a/internal/core/src/common/EasyAssert.h +++ b/internal/core/src/common/EasyAssert.h @@ -59,6 +59,7 @@ enum ErrorCode { ExprInvalid = 2028, UnistdError = 2030, MetricTypeNotMatch = 2031, + DimNotMatch = 2032, KnowhereError = 2100, }; diff --git a/internal/core/src/query/Plan.cpp b/internal/core/src/query/Plan.cpp index e74e387111..87f1488753 100644 --- a/internal/core/src/query/Plan.cpp +++ b/internal/core/src/query/Plan.cpp @@ -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()) {