Fix error message of proto parser not clear (#26365)

Signed-off-by: longjiquan <jiquan.long@zilliz.com>
pull/26414/head
Jiquan Long 2023-08-16 20:20:17 +08:00 committed by GitHub
parent 4aac7a6642
commit 95bcf3e900
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 39 additions and 3 deletions

View File

@ -699,8 +699,11 @@ ProtoParser::ParseExpr(const proto::plan::Expr& expr_pb) {
case ppe::kJsonContainsExpr: {
return ParseJsonContainsExpr(expr_pb.json_contains_expr());
}
default:
PanicInfo("unsupported expr proto node");
default: {
std::string s;
google::protobuf::TextFormat::PrintToString(expr_pb, &s);
PanicInfo(std::string("unsupported expr proto node: ") + s);
}
}
}

View File

@ -53,7 +53,8 @@ set(MILVUS_TEST_FILES
test_integer_overflow.cpp
test_offset_ordered_map.cpp
test_offset_ordered_array.cpp
test_always_true_expr.cpp)
test_always_true_expr.cpp
test_plan_proto.cpp)
if ( BUILD_DISK_ANN STREQUAL "ON" )
set(MILVUS_TEST_FILES

View File

@ -0,0 +1,32 @@
// Copyright (C) 2019-2020 Zilliz. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software distributed under the License
// is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
// or implied. See the License for the specific language governing permissions and limitations under the License
#include <gtest/gtest.h>
#include <memory>
#include <regex>
#include <vector>
#include <chrono>
#include "query/PlanProto.h"
TEST(PlanProto, NotSetUnsupported) {
using namespace milvus;
using namespace milvus::query;
auto schema = std::make_shared<Schema>();
auto vec_fid = schema->AddDebugField(
"fakevec", DataType::VECTOR_FLOAT, 16, knowhere::metric::L2);
auto i64_fid = schema->AddDebugField("age", DataType::INT64);
schema->set_primary_field_id(i64_fid);
proto::plan::Expr expr_pb;
ProtoParser parser(*schema);
ASSERT_ANY_THROW(parser.ParseExpr(expr_pb));
}