mirror of
https://gitee.com/milvus-io/milvus.git
synced 2024-12-04 04:49:08 +08:00
Add more error messages in segcore visitors (#8195)
Signed-off-by: fishpenguin <kun.yu@zilliz.com>
This commit is contained in:
parent
5046cbe5d8
commit
82e48fb379
@ -31,9 +31,9 @@ class ExecExprVisitor : ExprVisitor {
|
||||
}
|
||||
RetType
|
||||
call_child(Expr& expr) {
|
||||
Assert(!ret_.has_value());
|
||||
AssertInfo(!ret_.has_value(), "[ExecExprVisitor]Bitset already has value before accept");
|
||||
expr.accept(*this);
|
||||
Assert(ret_.has_value());
|
||||
AssertInfo(ret_.has_value(), "[ExecExprVisitor]Bitset doesn't have value after accept");
|
||||
auto res = std::move(ret_);
|
||||
ret_ = std::nullopt;
|
||||
return std::move(res.value());
|
||||
@ -83,7 +83,7 @@ ExecExprVisitor::visit(LogicalUnaryExpr& expr) {
|
||||
PanicInfo("Invalid Unary Op");
|
||||
}
|
||||
}
|
||||
Assert(res.size() == row_count_);
|
||||
AssertInfo(res.size() == row_count_, "[ExecExprVisitor]Size of results not equal row count");
|
||||
ret_ = std::move(res);
|
||||
}
|
||||
|
||||
@ -92,7 +92,7 @@ ExecExprVisitor::visit(LogicalBinaryExpr& expr) {
|
||||
using OpType = LogicalBinaryExpr::OpType;
|
||||
auto left = call_child(*expr.left_);
|
||||
auto right = call_child(*expr.right_);
|
||||
Assert(left.size() == right.size());
|
||||
AssertInfo(left.size() == right.size(), "[ExecExprVisitor]Left size not equal to right size");
|
||||
auto res = std::move(left);
|
||||
switch (expr.op_type_) {
|
||||
case OpType::LogicalAnd: {
|
||||
@ -115,7 +115,7 @@ ExecExprVisitor::visit(LogicalBinaryExpr& expr) {
|
||||
PanicInfo("Invalid Binary Op");
|
||||
}
|
||||
}
|
||||
Assert(res.size() == row_count_);
|
||||
AssertInfo(res.size() == row_count_, "[ExecExprVisitor]Size of results not equal row count");
|
||||
ret_ = std::move(res);
|
||||
}
|
||||
|
||||
@ -156,7 +156,7 @@ ExecExprVisitor::ExecRangeVisitorImpl(FieldOffset field_offset, IndexFunc index_
|
||||
// NOTE: knowhere is not const-ready
|
||||
// This is a dirty workaround
|
||||
auto data = index_func(const_cast<Index*>(&indexing));
|
||||
Assert(data->size() == size_per_chunk);
|
||||
AssertInfo(data->size() == size_per_chunk, "[ExecExprVisitor]Data size not equal to size_per_chunk");
|
||||
results.emplace_back(std::move(*data));
|
||||
}
|
||||
for (auto chunk_id = indexing_barrier; chunk_id < num_chunk; ++chunk_id) {
|
||||
@ -167,11 +167,11 @@ ExecExprVisitor::ExecRangeVisitorImpl(FieldOffset field_offset, IndexFunc index_
|
||||
for (int index = 0; index < this_size; ++index) {
|
||||
result[index] = element_func(data[index]);
|
||||
}
|
||||
Assert(result.size() == this_size);
|
||||
AssertInfo(result.size() == this_size, "");
|
||||
results.emplace_back(std::move(result));
|
||||
}
|
||||
auto final_result = Assemble(results);
|
||||
Assert(final_result.size() == row_count_);
|
||||
AssertInfo(final_result.size() == row_count_, "[ExecExprVisitor]Final result size not equal to row count");
|
||||
return final_result;
|
||||
}
|
||||
|
||||
@ -260,7 +260,8 @@ ExecExprVisitor::ExecBinaryRangeVisitorDispatcher(BinaryRangeExpr& expr_raw) ->
|
||||
void
|
||||
ExecExprVisitor::visit(UnaryRangeExpr& expr) {
|
||||
auto& field_meta = segment_.get_schema()[expr.field_offset_];
|
||||
Assert(expr.data_type_ == field_meta.get_data_type());
|
||||
AssertInfo(expr.data_type_ == field_meta.get_data_type(),
|
||||
"[ExecExprVisitor]DataType of expr isn't field_meta data type");
|
||||
RetType res;
|
||||
switch (expr.data_type_) {
|
||||
case DataType::BOOL: {
|
||||
@ -294,14 +295,15 @@ ExecExprVisitor::visit(UnaryRangeExpr& expr) {
|
||||
default:
|
||||
PanicInfo("unsupported");
|
||||
}
|
||||
Assert(res.size() == row_count_);
|
||||
AssertInfo(res.size() == row_count_, "[ExecExprVisitor]Size of results not equal row count");
|
||||
ret_ = std::move(res);
|
||||
}
|
||||
|
||||
void
|
||||
ExecExprVisitor::visit(BinaryRangeExpr& expr) {
|
||||
auto& field_meta = segment_.get_schema()[expr.field_offset_];
|
||||
Assert(expr.data_type_ == field_meta.get_data_type());
|
||||
AssertInfo(expr.data_type_ == field_meta.get_data_type(),
|
||||
"[ExecExprVisitor]DataType of expr isn't field_meta data type");
|
||||
RetType res;
|
||||
switch (expr.data_type_) {
|
||||
case DataType::BOOL: {
|
||||
@ -335,7 +337,7 @@ ExecExprVisitor::visit(BinaryRangeExpr& expr) {
|
||||
default:
|
||||
PanicInfo("unsupported");
|
||||
}
|
||||
Assert(res.size() == row_count_);
|
||||
AssertInfo(res.size() == row_count_, "[ExecExprVisitor]Size of results not equal row count");
|
||||
ret_ = std::move(res);
|
||||
}
|
||||
|
||||
@ -407,7 +409,7 @@ ExecExprVisitor::ExecCompareExprDispatcher(CompareExpr& expr, Op op) -> RetType
|
||||
bitsets.emplace_back(std::move(bitset));
|
||||
}
|
||||
auto final_result = Assemble(bitsets);
|
||||
Assert(final_result.size() == row_count_);
|
||||
AssertInfo(final_result.size() == row_count_, "[ExecExprVisitor]Size of results not equal row count");
|
||||
return final_result;
|
||||
}
|
||||
|
||||
@ -416,8 +418,10 @@ ExecExprVisitor::visit(CompareExpr& expr) {
|
||||
auto& schema = segment_.get_schema();
|
||||
auto& left_field_meta = schema[expr.left_field_offset_];
|
||||
auto& right_field_meta = schema[expr.right_field_offset_];
|
||||
Assert(expr.left_data_type_ == left_field_meta.get_data_type());
|
||||
Assert(expr.right_data_type_ == right_field_meta.get_data_type());
|
||||
AssertInfo(expr.left_data_type_ == left_field_meta.get_data_type(),
|
||||
"[ExecExprVisitor]Left data type not equal to left field mata type");
|
||||
AssertInfo(expr.right_data_type_ == right_field_meta.get_data_type(),
|
||||
"[ExecExprVisitor]right data type not equal to right field mata type");
|
||||
|
||||
RetType res;
|
||||
switch (expr.op_type_) {
|
||||
@ -449,7 +453,7 @@ ExecExprVisitor::visit(CompareExpr& expr) {
|
||||
PanicInfo("unsupported optype");
|
||||
}
|
||||
}
|
||||
Assert(res.size() == row_count_);
|
||||
AssertInfo(res.size() == row_count_, "[ExecExprVisitor]Size of results not equal row count");
|
||||
ret_ = std::move(res);
|
||||
}
|
||||
|
||||
@ -477,14 +481,15 @@ ExecExprVisitor::ExecTermVisitorImpl(TermExpr& expr_raw) -> RetType {
|
||||
bitsets.emplace_back(std::move(bitset));
|
||||
}
|
||||
auto final_result = Assemble(bitsets);
|
||||
Assert(final_result.size() == row_count_);
|
||||
AssertInfo(final_result.size() == row_count_, "[ExecExprVisitor]Size of results not equal row count");
|
||||
return final_result;
|
||||
}
|
||||
|
||||
void
|
||||
ExecExprVisitor::visit(TermExpr& expr) {
|
||||
auto& field_meta = segment_.get_schema()[expr.field_offset_];
|
||||
Assert(expr.data_type_ == field_meta.get_data_type());
|
||||
AssertInfo(expr.data_type_ == field_meta.get_data_type(),
|
||||
"[ExecExprVisitor]DataType of expr isn't field_meta data type ");
|
||||
RetType res;
|
||||
switch (expr.data_type_) {
|
||||
case DataType::BOOL: {
|
||||
@ -518,7 +523,7 @@ ExecExprVisitor::visit(TermExpr& expr) {
|
||||
default:
|
||||
PanicInfo("unsupported");
|
||||
}
|
||||
Assert(res.size() == row_count_);
|
||||
AssertInfo(res.size() == row_count_, "[ExecExprVisitor]Size of results not equal row count");
|
||||
ret_ = std::move(res);
|
||||
}
|
||||
} // namespace milvus::query
|
||||
|
Loading…
Reference in New Issue
Block a user