Support expr with json field (#23804)

Signed-off-by: cai.zhang <cai.zhang@zilliz.com>
This commit is contained in:
cai.zhang 2023-05-10 10:19:19 +08:00 committed by GitHub
parent 6415ee8cd9
commit 9715a850fa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
38 changed files with 4764 additions and 1406 deletions

View File

@ -83,6 +83,19 @@ struct ColumnExprDefaultTypeInternal {
};
};
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 ColumnExprDefaultTypeInternal _ColumnExpr_default_instance_;
PROTOBUF_CONSTEXPR ExistsExpr::ExistsExpr(
::_pbi::ConstantInitialized): _impl_{
/*decltype(_impl_.info_)*/nullptr
, /*decltype(_impl_._cached_size_)*/{}} {}
struct ExistsExprDefaultTypeInternal {
PROTOBUF_CONSTEXPR ExistsExprDefaultTypeInternal()
: _instance(::_pbi::ConstantInitialized{}) {}
~ExistsExprDefaultTypeInternal() {}
union {
ExistsExpr _instance;
};
};
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 ExistsExprDefaultTypeInternal _ExistsExpr_default_instance_;
PROTOBUF_CONSTEXPR ValueExpr::ValueExpr(
::_pbi::ConstantInitialized): _impl_{
/*decltype(_impl_.value_)*/nullptr
@ -297,7 +310,7 @@ PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORIT
} // namespace plan
} // namespace proto
} // namespace milvus
static ::_pb::Metadata file_level_metadata_plan_2eproto[18];
static ::_pb::Metadata file_level_metadata_plan_2eproto[19];
static const ::_pb::EnumDescriptor* file_level_enum_descriptors_plan_2eproto[4];
static constexpr ::_pb::ServiceDescriptor const** file_level_service_descriptors_plan_2eproto = nullptr;
@ -342,6 +355,13 @@ const uint32_t TableStruct_plan_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(pro
~0u, // no _inlined_string_donated_
PROTOBUF_FIELD_OFFSET(::milvus::proto::plan::ColumnExpr, _impl_.info_),
~0u, // no _has_bits_
PROTOBUF_FIELD_OFFSET(::milvus::proto::plan::ExistsExpr, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
~0u, // no _inlined_string_donated_
PROTOBUF_FIELD_OFFSET(::milvus::proto::plan::ExistsExpr, _impl_.info_),
~0u, // no _has_bits_
PROTOBUF_FIELD_OFFSET(::milvus::proto::plan::ValueExpr, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
@ -447,6 +467,7 @@ const uint32_t TableStruct_plan_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(pro
::_pbi::kInvalidFieldOffsetTag,
::_pbi::kInvalidFieldOffsetTag,
::_pbi::kInvalidFieldOffsetTag,
::_pbi::kInvalidFieldOffsetTag,
PROTOBUF_FIELD_OFFSET(::milvus::proto::plan::Expr, _impl_.expr_),
~0u, // no _has_bits_
PROTOBUF_FIELD_OFFSET(::milvus::proto::plan::VectorANNS, _internal_metadata_),
@ -484,20 +505,21 @@ static const ::_pbi::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protode
{ 11, -1, -1, sizeof(::milvus::proto::plan::QueryInfo)},
{ 21, -1, -1, sizeof(::milvus::proto::plan::ColumnInfo)},
{ 32, -1, -1, sizeof(::milvus::proto::plan::ColumnExpr)},
{ 39, -1, -1, sizeof(::milvus::proto::plan::ValueExpr)},
{ 46, -1, -1, sizeof(::milvus::proto::plan::UnaryRangeExpr)},
{ 55, -1, -1, sizeof(::milvus::proto::plan::BinaryRangeExpr)},
{ 66, -1, -1, sizeof(::milvus::proto::plan::CompareExpr)},
{ 75, -1, -1, sizeof(::milvus::proto::plan::TermExpr)},
{ 83, -1, -1, sizeof(::milvus::proto::plan::UnaryExpr)},
{ 91, -1, -1, sizeof(::milvus::proto::plan::BinaryExpr)},
{ 100, -1, -1, sizeof(::milvus::proto::plan::BinaryArithOp)},
{ 109, -1, -1, sizeof(::milvus::proto::plan::BinaryArithExpr)},
{ 118, -1, -1, sizeof(::milvus::proto::plan::BinaryArithOpEvalRangeExpr)},
{ 129, -1, -1, sizeof(::milvus::proto::plan::Expr)},
{ 146, -1, -1, sizeof(::milvus::proto::plan::VectorANNS)},
{ 157, -1, -1, sizeof(::milvus::proto::plan::QueryPlanNode)},
{ 165, -1, -1, sizeof(::milvus::proto::plan::PlanNode)},
{ 39, -1, -1, sizeof(::milvus::proto::plan::ExistsExpr)},
{ 46, -1, -1, sizeof(::milvus::proto::plan::ValueExpr)},
{ 53, -1, -1, sizeof(::milvus::proto::plan::UnaryRangeExpr)},
{ 62, -1, -1, sizeof(::milvus::proto::plan::BinaryRangeExpr)},
{ 73, -1, -1, sizeof(::milvus::proto::plan::CompareExpr)},
{ 82, -1, -1, sizeof(::milvus::proto::plan::TermExpr)},
{ 90, -1, -1, sizeof(::milvus::proto::plan::UnaryExpr)},
{ 98, -1, -1, sizeof(::milvus::proto::plan::BinaryExpr)},
{ 107, -1, -1, sizeof(::milvus::proto::plan::BinaryArithOp)},
{ 116, -1, -1, sizeof(::milvus::proto::plan::BinaryArithExpr)},
{ 125, -1, -1, sizeof(::milvus::proto::plan::BinaryArithOpEvalRangeExpr)},
{ 136, -1, -1, sizeof(::milvus::proto::plan::Expr)},
{ 154, -1, -1, sizeof(::milvus::proto::plan::VectorANNS)},
{ 165, -1, -1, sizeof(::milvus::proto::plan::QueryPlanNode)},
{ 173, -1, -1, sizeof(::milvus::proto::plan::PlanNode)},
};
static const ::_pb::Message* const file_default_instances[] = {
@ -505,6 +527,7 @@ static const ::_pb::Message* const file_default_instances[] = {
&::milvus::proto::plan::_QueryInfo_default_instance_._instance,
&::milvus::proto::plan::_ColumnInfo_default_instance_._instance,
&::milvus::proto::plan::_ColumnExpr_default_instance_._instance,
&::milvus::proto::plan::_ExistsExpr_default_instance_._instance,
&::milvus::proto::plan::_ValueExpr_default_instance_._instance,
&::milvus::proto::plan::_UnaryRangeExpr_default_instance_._instance,
&::milvus::proto::plan::_BinaryRangeExpr_default_instance_._instance,
@ -533,92 +556,95 @@ const char descriptor_table_protodef_plan_2eproto[] PROTOBUF_SECTION_VARIABLE(pr
".DataType\022\026\n\016is_primary_key\030\003 \001(\010\022\021\n\tis_"
"autoID\030\004 \001(\010\022\023\n\013nested_path\030\005 \003(\t\"9\n\nCol"
"umnExpr\022+\n\004info\030\001 \001(\0132\035.milvus.proto.pla"
"n.ColumnInfo\";\n\tValueExpr\022.\n\005value\030\001 \001(\013"
"2\037.milvus.proto.plan.GenericValue\"\233\001\n\016Un"
"aryRangeExpr\0222\n\013column_info\030\001 \001(\0132\035.milv"
"us.proto.plan.ColumnInfo\022%\n\002op\030\002 \001(\0162\031.m"
"ilvus.proto.plan.OpType\022.\n\005value\030\003 \001(\0132\037"
".milvus.proto.plan.GenericValue\"\343\001\n\017Bina"
"ryRangeExpr\0222\n\013column_info\030\001 \001(\0132\035.milvu"
"s.proto.plan.ColumnInfo\022\027\n\017lower_inclusi"
"ve\030\002 \001(\010\022\027\n\017upper_inclusive\030\003 \001(\010\0224\n\013low"
"er_value\030\004 \001(\0132\037.milvus.proto.plan.Gener"
"icValue\0224\n\013upper_value\030\005 \001(\0132\037.milvus.pr"
"oto.plan.GenericValue\"\247\001\n\013CompareExpr\0227\n"
"\020left_column_info\030\001 \001(\0132\035.milvus.proto.p"
"lan.ColumnInfo\0228\n\021right_column_info\030\002 \001("
"\0132\035.milvus.proto.plan.ColumnInfo\022%\n\002op\030\003"
" \001(\0162\031.milvus.proto.plan.OpType\"o\n\010TermE"
"xpr\0222\n\013column_info\030\001 \001(\0132\035.milvus.proto."
"plan.ColumnInfo\022/\n\006values\030\002 \003(\0132\037.milvus"
".proto.plan.GenericValue\"\206\001\n\tUnaryExpr\0220"
"\n\002op\030\001 \001(\0162$.milvus.proto.plan.UnaryExpr"
".UnaryOp\022&\n\005child\030\002 \001(\0132\027.milvus.proto.p"
"lan.Expr\"\037\n\007UnaryOp\022\013\n\007Invalid\020\000\022\007\n\003Not\020"
"\001\"\307\001\n\nBinaryExpr\0222\n\002op\030\001 \001(\0162&.milvus.pr"
"oto.plan.BinaryExpr.BinaryOp\022%\n\004left\030\002 \001"
"(\0132\027.milvus.proto.plan.Expr\022&\n\005right\030\003 \001"
"(\0132\027.milvus.proto.plan.Expr\"6\n\010BinaryOp\022"
"\013\n\007Invalid\020\000\022\016\n\nLogicalAnd\020\001\022\r\n\tLogicalO"
"r\020\002\"\255\001\n\rBinaryArithOp\0222\n\013column_info\030\001 \001"
"(\0132\035.milvus.proto.plan.ColumnInfo\0220\n\010ari"
"th_op\030\002 \001(\0162\036.milvus.proto.plan.ArithOpT"
"ype\0226\n\rright_operand\030\003 \001(\0132\037.milvus.prot"
"o.plan.GenericValue\"\214\001\n\017BinaryArithExpr\022"
"%\n\004left\030\001 \001(\0132\027.milvus.proto.plan.Expr\022&"
"\n\005right\030\002 \001(\0132\027.milvus.proto.plan.Expr\022*"
"\n\002op\030\003 \001(\0162\036.milvus.proto.plan.ArithOpTy"
"pe\"\221\002\n\032BinaryArithOpEvalRangeExpr\0222\n\013col"
"umn_info\030\001 \001(\0132\035.milvus.proto.plan.Colum"
"nInfo\0220\n\010arith_op\030\002 \001(\0162\036.milvus.proto.p"
"lan.ArithOpType\0226\n\rright_operand\030\003 \001(\0132\037"
".milvus.proto.plan.GenericValue\022%\n\002op\030\004 "
"\001(\0162\031.milvus.proto.plan.OpType\022.\n\005value\030"
"\005 \001(\0132\037.milvus.proto.plan.GenericValue\"\347"
"\004\n\004Expr\0220\n\tterm_expr\030\001 \001(\0132\033.milvus.prot"
"o.plan.TermExprH\000\0222\n\nunary_expr\030\002 \001(\0132\034."
"milvus.proto.plan.UnaryExprH\000\0224\n\013binary_"
"expr\030\003 \001(\0132\035.milvus.proto.plan.BinaryExp"
"rH\000\0226\n\014compare_expr\030\004 \001(\0132\036.milvus.proto"
".plan.CompareExprH\000\022=\n\020unary_range_expr\030"
"\005 \001(\0132!.milvus.proto.plan.UnaryRangeExpr"
"H\000\022\?\n\021binary_range_expr\030\006 \001(\0132\".milvus.p"
"roto.plan.BinaryRangeExprH\000\022X\n\037binary_ar"
"ith_op_eval_range_expr\030\007 \001(\0132-.milvus.pr"
"oto.plan.BinaryArithOpEvalRangeExprH\000\022\?\n"
"\021binary_arith_expr\030\010 \001(\0132\".milvus.proto."
"plan.BinaryArithExprH\000\0222\n\nvalue_expr\030\t \001"
"(\0132\034.milvus.proto.plan.ValueExprH\000\0224\n\013co"
"lumn_expr\030\n \001(\0132\035.milvus.proto.plan.Colu"
"mnExprH\000B\006\n\004expr\"\251\001\n\nVectorANNS\022\021\n\tis_bi"
"nary\030\001 \001(\010\022\020\n\010field_id\030\002 \001(\003\022+\n\npredicat"
"es\030\003 \001(\0132\027.milvus.proto.plan.Expr\0220\n\nque"
"ry_info\030\004 \001(\0132\034.milvus.proto.plan.QueryI"
"nfo\022\027\n\017placeholder_tag\030\005 \001(\t\"N\n\rQueryPla"
"nNode\022+\n\npredicates\030\001 \001(\0132\027.milvus.proto"
".plan.Expr\022\020\n\010is_count\030\002 \001(\010\"\304\001\n\010PlanNod"
"e\0224\n\013vector_anns\030\001 \001(\0132\035.milvus.proto.pl"
"an.VectorANNSH\000\022-\n\npredicates\030\002 \001(\0132\027.mi"
"lvus.proto.plan.ExprH\000\0221\n\005query\030\004 \001(\0132 ."
"milvus.proto.plan.QueryPlanNodeH\000\022\030\n\020out"
"put_field_ids\030\003 \003(\003B\006\n\004node*\272\001\n\006OpType\022\013"
"\n\007Invalid\020\000\022\017\n\013GreaterThan\020\001\022\020\n\014GreaterE"
"qual\020\002\022\014\n\010LessThan\020\003\022\r\n\tLessEqual\020\004\022\t\n\005E"
"qual\020\005\022\014\n\010NotEqual\020\006\022\017\n\013PrefixMatch\020\007\022\020\n"
"\014PostfixMatch\020\010\022\t\n\005Match\020\t\022\t\n\005Range\020\n\022\006\n"
"\002In\020\013\022\t\n\005NotIn\020\014*G\n\013ArithOpType\022\013\n\007Unkno"
"wn\020\000\022\007\n\003Add\020\001\022\007\n\003Sub\020\002\022\007\n\003Mul\020\003\022\007\n\003Div\020\004"
"\022\007\n\003Mod\020\005B3Z1github.com/milvus-io/milvus"
"/internal/proto/planpbb\006proto3"
"n.ColumnInfo\"9\n\nExistsExpr\022+\n\004info\030\001 \001(\013"
"2\035.milvus.proto.plan.ColumnInfo\";\n\tValue"
"Expr\022.\n\005value\030\001 \001(\0132\037.milvus.proto.plan."
"GenericValue\"\233\001\n\016UnaryRangeExpr\0222\n\013colum"
"n_info\030\001 \001(\0132\035.milvus.proto.plan.ColumnI"
"nfo\022%\n\002op\030\002 \001(\0162\031.milvus.proto.plan.OpTy"
"pe\022.\n\005value\030\003 \001(\0132\037.milvus.proto.plan.Ge"
"nericValue\"\343\001\n\017BinaryRangeExpr\0222\n\013column"
"_info\030\001 \001(\0132\035.milvus.proto.plan.ColumnIn"
"fo\022\027\n\017lower_inclusive\030\002 \001(\010\022\027\n\017upper_inc"
"lusive\030\003 \001(\010\0224\n\013lower_value\030\004 \001(\0132\037.milv"
"us.proto.plan.GenericValue\0224\n\013upper_valu"
"e\030\005 \001(\0132\037.milvus.proto.plan.GenericValue"
"\"\247\001\n\013CompareExpr\0227\n\020left_column_info\030\001 \001"
"(\0132\035.milvus.proto.plan.ColumnInfo\0228\n\021rig"
"ht_column_info\030\002 \001(\0132\035.milvus.proto.plan"
".ColumnInfo\022%\n\002op\030\003 \001(\0162\031.milvus.proto.p"
"lan.OpType\"o\n\010TermExpr\0222\n\013column_info\030\001 "
"\001(\0132\035.milvus.proto.plan.ColumnInfo\022/\n\006va"
"lues\030\002 \003(\0132\037.milvus.proto.plan.GenericVa"
"lue\"\206\001\n\tUnaryExpr\0220\n\002op\030\001 \001(\0162$.milvus.p"
"roto.plan.UnaryExpr.UnaryOp\022&\n\005child\030\002 \001"
"(\0132\027.milvus.proto.plan.Expr\"\037\n\007UnaryOp\022\013"
"\n\007Invalid\020\000\022\007\n\003Not\020\001\"\307\001\n\nBinaryExpr\0222\n\002o"
"p\030\001 \001(\0162&.milvus.proto.plan.BinaryExpr.B"
"inaryOp\022%\n\004left\030\002 \001(\0132\027.milvus.proto.pla"
"n.Expr\022&\n\005right\030\003 \001(\0132\027.milvus.proto.pla"
"n.Expr\"6\n\010BinaryOp\022\013\n\007Invalid\020\000\022\016\n\nLogic"
"alAnd\020\001\022\r\n\tLogicalOr\020\002\"\255\001\n\rBinaryArithOp"
"\0222\n\013column_info\030\001 \001(\0132\035.milvus.proto.pla"
"n.ColumnInfo\0220\n\010arith_op\030\002 \001(\0162\036.milvus."
"proto.plan.ArithOpType\0226\n\rright_operand\030"
"\003 \001(\0132\037.milvus.proto.plan.GenericValue\"\214"
"\001\n\017BinaryArithExpr\022%\n\004left\030\001 \001(\0132\027.milvu"
"s.proto.plan.Expr\022&\n\005right\030\002 \001(\0132\027.milvu"
"s.proto.plan.Expr\022*\n\002op\030\003 \001(\0162\036.milvus.p"
"roto.plan.ArithOpType\"\221\002\n\032BinaryArithOpE"
"valRangeExpr\0222\n\013column_info\030\001 \001(\0132\035.milv"
"us.proto.plan.ColumnInfo\0220\n\010arith_op\030\002 \001"
"(\0162\036.milvus.proto.plan.ArithOpType\0226\n\rri"
"ght_operand\030\003 \001(\0132\037.milvus.proto.plan.Ge"
"nericValue\022%\n\002op\030\004 \001(\0162\031.milvus.proto.pl"
"an.OpType\022.\n\005value\030\005 \001(\0132\037.milvus.proto."
"plan.GenericValue\"\235\005\n\004Expr\0220\n\tterm_expr\030"
"\001 \001(\0132\033.milvus.proto.plan.TermExprH\000\0222\n\n"
"unary_expr\030\002 \001(\0132\034.milvus.proto.plan.Una"
"ryExprH\000\0224\n\013binary_expr\030\003 \001(\0132\035.milvus.p"
"roto.plan.BinaryExprH\000\0226\n\014compare_expr\030\004"
" \001(\0132\036.milvus.proto.plan.CompareExprH\000\022="
"\n\020unary_range_expr\030\005 \001(\0132!.milvus.proto."
"plan.UnaryRangeExprH\000\022\?\n\021binary_range_ex"
"pr\030\006 \001(\0132\".milvus.proto.plan.BinaryRange"
"ExprH\000\022X\n\037binary_arith_op_eval_range_exp"
"r\030\007 \001(\0132-.milvus.proto.plan.BinaryArithO"
"pEvalRangeExprH\000\022\?\n\021binary_arith_expr\030\010 "
"\001(\0132\".milvus.proto.plan.BinaryArithExprH"
"\000\0222\n\nvalue_expr\030\t \001(\0132\034.milvus.proto.pla"
"n.ValueExprH\000\0224\n\013column_expr\030\n \001(\0132\035.mil"
"vus.proto.plan.ColumnExprH\000\0224\n\013exists_ex"
"pr\030\013 \001(\0132\035.milvus.proto.plan.ExistsExprH"
"\000B\006\n\004expr\"\251\001\n\nVectorANNS\022\021\n\tis_binary\030\001 "
"\001(\010\022\020\n\010field_id\030\002 \001(\003\022+\n\npredicates\030\003 \001("
"\0132\027.milvus.proto.plan.Expr\0220\n\nquery_info"
"\030\004 \001(\0132\034.milvus.proto.plan.QueryInfo\022\027\n\017"
"placeholder_tag\030\005 \001(\t\"N\n\rQueryPlanNode\022+"
"\n\npredicates\030\001 \001(\0132\027.milvus.proto.plan.E"
"xpr\022\020\n\010is_count\030\002 \001(\010\"\304\001\n\010PlanNode\0224\n\013ve"
"ctor_anns\030\001 \001(\0132\035.milvus.proto.plan.Vect"
"orANNSH\000\022-\n\npredicates\030\002 \001(\0132\027.milvus.pr"
"oto.plan.ExprH\000\0221\n\005query\030\004 \001(\0132 .milvus."
"proto.plan.QueryPlanNodeH\000\022\030\n\020output_fie"
"ld_ids\030\003 \003(\003B\006\n\004node*\272\001\n\006OpType\022\013\n\007Inval"
"id\020\000\022\017\n\013GreaterThan\020\001\022\020\n\014GreaterEqual\020\002\022"
"\014\n\010LessThan\020\003\022\r\n\tLessEqual\020\004\022\t\n\005Equal\020\005\022"
"\014\n\010NotEqual\020\006\022\017\n\013PrefixMatch\020\007\022\020\n\014Postfi"
"xMatch\020\010\022\t\n\005Match\020\t\022\t\n\005Range\020\n\022\006\n\002In\020\013\022\t"
"\n\005NotIn\020\014*G\n\013ArithOpType\022\013\n\007Unknown\020\000\022\007\n"
"\003Add\020\001\022\007\n\003Sub\020\002\022\007\n\003Mul\020\003\022\007\n\003Div\020\004\022\007\n\003Mod"
"\020\005B3Z1github.com/milvus-io/milvus/intern"
"al/proto/planpbb\006proto3"
;
static const ::_pbi::DescriptorTable* const descriptor_table_plan_2eproto_deps[1] = {
&::descriptor_table_schema_2eproto,
};
static ::_pbi::once_flag descriptor_table_plan_2eproto_once;
const ::_pbi::DescriptorTable descriptor_table_plan_2eproto = {
false, false, 3510, descriptor_table_protodef_plan_2eproto,
false, false, 3623, descriptor_table_protodef_plan_2eproto,
"plan.proto",
&descriptor_table_plan_2eproto_once, descriptor_table_plan_2eproto_deps, 1, 18,
&descriptor_table_plan_2eproto_once, descriptor_table_plan_2eproto_deps, 1, 19,
schemas, file_default_instances, TableStruct_plan_2eproto::offsets,
file_level_metadata_plan_2eproto, file_level_enum_descriptors_plan_2eproto,
file_level_service_descriptors_plan_2eproto,
@ -1850,6 +1876,199 @@ void ColumnExpr::InternalSwap(ColumnExpr* other) {
// ===================================================================
class ExistsExpr::_Internal {
public:
static const ::milvus::proto::plan::ColumnInfo& info(const ExistsExpr* msg);
};
const ::milvus::proto::plan::ColumnInfo&
ExistsExpr::_Internal::info(const ExistsExpr* msg) {
return *msg->_impl_.info_;
}
ExistsExpr::ExistsExpr(::PROTOBUF_NAMESPACE_ID::Arena* arena,
bool is_message_owned)
: ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) {
SharedCtor(arena, is_message_owned);
// @@protoc_insertion_point(arena_constructor:milvus.proto.plan.ExistsExpr)
}
ExistsExpr::ExistsExpr(const ExistsExpr& from)
: ::PROTOBUF_NAMESPACE_ID::Message() {
ExistsExpr* const _this = this; (void)_this;
new (&_impl_) Impl_{
decltype(_impl_.info_){nullptr}
, /*decltype(_impl_._cached_size_)*/{}};
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
if (from._internal_has_info()) {
_this->_impl_.info_ = new ::milvus::proto::plan::ColumnInfo(*from._impl_.info_);
}
// @@protoc_insertion_point(copy_constructor:milvus.proto.plan.ExistsExpr)
}
inline void ExistsExpr::SharedCtor(
::_pb::Arena* arena, bool is_message_owned) {
(void)arena;
(void)is_message_owned;
new (&_impl_) Impl_{
decltype(_impl_.info_){nullptr}
, /*decltype(_impl_._cached_size_)*/{}
};
}
ExistsExpr::~ExistsExpr() {
// @@protoc_insertion_point(destructor:milvus.proto.plan.ExistsExpr)
if (auto *arena = _internal_metadata_.DeleteReturnArena<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>()) {
(void)arena;
return;
}
SharedDtor();
}
inline void ExistsExpr::SharedDtor() {
GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
if (this != internal_default_instance()) delete _impl_.info_;
}
void ExistsExpr::SetCachedSize(int size) const {
_impl_._cached_size_.Set(size);
}
void ExistsExpr::Clear() {
// @@protoc_insertion_point(message_clear_start:milvus.proto.plan.ExistsExpr)
uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
if (GetArenaForAllocation() == nullptr && _impl_.info_ != nullptr) {
delete _impl_.info_;
}
_impl_.info_ = nullptr;
_internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
}
const char* ExistsExpr::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
while (!ctx->Done(&ptr)) {
uint32_t tag;
ptr = ::_pbi::ReadTag(ptr, &tag);
switch (tag >> 3) {
// .milvus.proto.plan.ColumnInfo info = 1;
case 1:
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) {
ptr = ctx->ParseMessage(_internal_mutable_info(), ptr);
CHK_(ptr);
} else
goto handle_unusual;
continue;
default:
goto handle_unusual;
} // switch
handle_unusual:
if ((tag == 0) || ((tag & 7) == 4)) {
CHK_(ptr);
ctx->SetLastTag(tag);
goto message_done;
}
ptr = UnknownFieldParse(
tag,
_internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(),
ptr, ctx);
CHK_(ptr != nullptr);
} // while
message_done:
return ptr;
failure:
ptr = nullptr;
goto message_done;
#undef CHK_
}
uint8_t* ExistsExpr::_InternalSerialize(
uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
// @@protoc_insertion_point(serialize_to_array_start:milvus.proto.plan.ExistsExpr)
uint32_t cached_has_bits = 0;
(void) cached_has_bits;
// .milvus.proto.plan.ColumnInfo info = 1;
if (this->_internal_has_info()) {
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
InternalWriteMessage(1, _Internal::info(this),
_Internal::info(this).GetCachedSize(), target, stream);
}
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
target = ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray(
_internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream);
}
// @@protoc_insertion_point(serialize_to_array_end:milvus.proto.plan.ExistsExpr)
return target;
}
size_t ExistsExpr::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:milvus.proto.plan.ExistsExpr)
size_t total_size = 0;
uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
// .milvus.proto.plan.ColumnInfo info = 1;
if (this->_internal_has_info()) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
*_impl_.info_);
}
return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_);
}
const ::PROTOBUF_NAMESPACE_ID::Message::ClassData ExistsExpr::_class_data_ = {
::PROTOBUF_NAMESPACE_ID::Message::CopyWithSourceCheck,
ExistsExpr::MergeImpl
};
const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*ExistsExpr::GetClassData() const { return &_class_data_; }
void ExistsExpr::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg) {
auto* const _this = static_cast<ExistsExpr*>(&to_msg);
auto& from = static_cast<const ExistsExpr&>(from_msg);
// @@protoc_insertion_point(class_specific_merge_from_start:milvus.proto.plan.ExistsExpr)
GOOGLE_DCHECK_NE(&from, _this);
uint32_t cached_has_bits = 0;
(void) cached_has_bits;
if (from._internal_has_info()) {
_this->_internal_mutable_info()->::milvus::proto::plan::ColumnInfo::MergeFrom(
from._internal_info());
}
_this->_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
}
void ExistsExpr::CopyFrom(const ExistsExpr& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:milvus.proto.plan.ExistsExpr)
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool ExistsExpr::IsInitialized() const {
return true;
}
void ExistsExpr::InternalSwap(ExistsExpr* other) {
using std::swap;
_internal_metadata_.InternalSwap(&other->_internal_metadata_);
swap(_impl_.info_, other->_impl_.info_);
}
::PROTOBUF_NAMESPACE_ID::Metadata ExistsExpr::GetMetadata() const {
return ::_pbi::AssignDescriptors(
&descriptor_table_plan_2eproto_getter, &descriptor_table_plan_2eproto_once,
file_level_metadata_plan_2eproto[4]);
}
// ===================================================================
class ValueExpr::_Internal {
public:
static const ::milvus::proto::plan::GenericValue& value(const ValueExpr* msg);
@ -2038,7 +2257,7 @@ void ValueExpr::InternalSwap(ValueExpr* other) {
::PROTOBUF_NAMESPACE_ID::Metadata ValueExpr::GetMetadata() const {
return ::_pbi::AssignDescriptors(
&descriptor_table_plan_2eproto_getter, &descriptor_table_plan_2eproto_once,
file_level_metadata_plan_2eproto[4]);
file_level_metadata_plan_2eproto[5]);
}
// ===================================================================
@ -2306,7 +2525,7 @@ void UnaryRangeExpr::InternalSwap(UnaryRangeExpr* other) {
::PROTOBUF_NAMESPACE_ID::Metadata UnaryRangeExpr::GetMetadata() const {
return ::_pbi::AssignDescriptors(
&descriptor_table_plan_2eproto_getter, &descriptor_table_plan_2eproto_once,
file_level_metadata_plan_2eproto[5]);
file_level_metadata_plan_2eproto[6]);
}
// ===================================================================
@ -2640,7 +2859,7 @@ void BinaryRangeExpr::InternalSwap(BinaryRangeExpr* other) {
::PROTOBUF_NAMESPACE_ID::Metadata BinaryRangeExpr::GetMetadata() const {
return ::_pbi::AssignDescriptors(
&descriptor_table_plan_2eproto_getter, &descriptor_table_plan_2eproto_once,
file_level_metadata_plan_2eproto[6]);
file_level_metadata_plan_2eproto[7]);
}
// ===================================================================
@ -2908,7 +3127,7 @@ void CompareExpr::InternalSwap(CompareExpr* other) {
::PROTOBUF_NAMESPACE_ID::Metadata CompareExpr::GetMetadata() const {
return ::_pbi::AssignDescriptors(
&descriptor_table_plan_2eproto_getter, &descriptor_table_plan_2eproto_once,
file_level_metadata_plan_2eproto[7]);
file_level_metadata_plan_2eproto[8]);
}
// ===================================================================
@ -3135,7 +3354,7 @@ void TermExpr::InternalSwap(TermExpr* other) {
::PROTOBUF_NAMESPACE_ID::Metadata TermExpr::GetMetadata() const {
return ::_pbi::AssignDescriptors(
&descriptor_table_plan_2eproto_getter, &descriptor_table_plan_2eproto_once,
file_level_metadata_plan_2eproto[8]);
file_level_metadata_plan_2eproto[9]);
}
// ===================================================================
@ -3362,7 +3581,7 @@ void UnaryExpr::InternalSwap(UnaryExpr* other) {
::PROTOBUF_NAMESPACE_ID::Metadata UnaryExpr::GetMetadata() const {
return ::_pbi::AssignDescriptors(
&descriptor_table_plan_2eproto_getter, &descriptor_table_plan_2eproto_once,
file_level_metadata_plan_2eproto[9]);
file_level_metadata_plan_2eproto[10]);
}
// ===================================================================
@ -3630,7 +3849,7 @@ void BinaryExpr::InternalSwap(BinaryExpr* other) {
::PROTOBUF_NAMESPACE_ID::Metadata BinaryExpr::GetMetadata() const {
return ::_pbi::AssignDescriptors(
&descriptor_table_plan_2eproto_getter, &descriptor_table_plan_2eproto_once,
file_level_metadata_plan_2eproto[10]);
file_level_metadata_plan_2eproto[11]);
}
// ===================================================================
@ -3898,7 +4117,7 @@ void BinaryArithOp::InternalSwap(BinaryArithOp* other) {
::PROTOBUF_NAMESPACE_ID::Metadata BinaryArithOp::GetMetadata() const {
return ::_pbi::AssignDescriptors(
&descriptor_table_plan_2eproto_getter, &descriptor_table_plan_2eproto_once,
file_level_metadata_plan_2eproto[11]);
file_level_metadata_plan_2eproto[12]);
}
// ===================================================================
@ -4166,7 +4385,7 @@ void BinaryArithExpr::InternalSwap(BinaryArithExpr* other) {
::PROTOBUF_NAMESPACE_ID::Metadata BinaryArithExpr::GetMetadata() const {
return ::_pbi::AssignDescriptors(
&descriptor_table_plan_2eproto_getter, &descriptor_table_plan_2eproto_once,
file_level_metadata_plan_2eproto[12]);
file_level_metadata_plan_2eproto[13]);
}
// ===================================================================
@ -4506,7 +4725,7 @@ void BinaryArithOpEvalRangeExpr::InternalSwap(BinaryArithOpEvalRangeExpr* other)
::PROTOBUF_NAMESPACE_ID::Metadata BinaryArithOpEvalRangeExpr::GetMetadata() const {
return ::_pbi::AssignDescriptors(
&descriptor_table_plan_2eproto_getter, &descriptor_table_plan_2eproto_once,
file_level_metadata_plan_2eproto[13]);
file_level_metadata_plan_2eproto[14]);
}
// ===================================================================
@ -4523,6 +4742,7 @@ class Expr::_Internal {
static const ::milvus::proto::plan::BinaryArithExpr& binary_arith_expr(const Expr* msg);
static const ::milvus::proto::plan::ValueExpr& value_expr(const Expr* msg);
static const ::milvus::proto::plan::ColumnExpr& column_expr(const Expr* msg);
static const ::milvus::proto::plan::ExistsExpr& exists_expr(const Expr* msg);
};
const ::milvus::proto::plan::TermExpr&
@ -4565,6 +4785,10 @@ const ::milvus::proto::plan::ColumnExpr&
Expr::_Internal::column_expr(const Expr* msg) {
return *msg->_impl_.expr_.column_expr_;
}
const ::milvus::proto::plan::ExistsExpr&
Expr::_Internal::exists_expr(const Expr* msg) {
return *msg->_impl_.expr_.exists_expr_;
}
void Expr::set_allocated_term_expr(::milvus::proto::plan::TermExpr* term_expr) {
::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation();
clear_expr();
@ -4715,6 +4939,21 @@ void Expr::set_allocated_column_expr(::milvus::proto::plan::ColumnExpr* column_e
}
// @@protoc_insertion_point(field_set_allocated:milvus.proto.plan.Expr.column_expr)
}
void Expr::set_allocated_exists_expr(::milvus::proto::plan::ExistsExpr* exists_expr) {
::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation();
clear_expr();
if (exists_expr) {
::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena =
::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena(exists_expr);
if (message_arena != submessage_arena) {
exists_expr = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
message_arena, exists_expr, submessage_arena);
}
set_has_exists_expr();
_impl_.expr_.exists_expr_ = exists_expr;
}
// @@protoc_insertion_point(field_set_allocated:milvus.proto.plan.Expr.exists_expr)
}
Expr::Expr(::PROTOBUF_NAMESPACE_ID::Arena* arena,
bool is_message_owned)
: ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) {
@ -4782,6 +5021,11 @@ Expr::Expr(const Expr& from)
from._internal_column_expr());
break;
}
case kExistsExpr: {
_this->_internal_mutable_exists_expr()->::milvus::proto::plan::ExistsExpr::MergeFrom(
from._internal_exists_expr());
break;
}
case EXPR_NOT_SET: {
break;
}
@ -4884,6 +5128,12 @@ void Expr::clear_expr() {
}
break;
}
case kExistsExpr: {
if (GetArenaForAllocation() == nullptr) {
delete _impl_.expr_.exists_expr_;
}
break;
}
case EXPR_NOT_SET: {
break;
}
@ -4988,6 +5238,14 @@ const char* Expr::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) {
} else
goto handle_unusual;
continue;
// .milvus.proto.plan.ExistsExpr exists_expr = 11;
case 11:
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 90)) {
ptr = ctx->ParseMessage(_internal_mutable_exists_expr(), ptr);
CHK_(ptr);
} else
goto handle_unusual;
continue;
default:
goto handle_unusual;
} // switch
@ -5087,6 +5345,13 @@ uint8_t* Expr::_InternalSerialize(
_Internal::column_expr(this).GetCachedSize(), target, stream);
}
// .milvus.proto.plan.ExistsExpr exists_expr = 11;
if (_internal_has_exists_expr()) {
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
InternalWriteMessage(11, _Internal::exists_expr(this),
_Internal::exists_expr(this).GetCachedSize(), target, stream);
}
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
target = ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray(
_internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream);
@ -5174,6 +5439,13 @@ size_t Expr::ByteSizeLong() const {
*_impl_.expr_.column_expr_);
break;
}
// .milvus.proto.plan.ExistsExpr exists_expr = 11;
case kExistsExpr: {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
*_impl_.expr_.exists_expr_);
break;
}
case EXPR_NOT_SET: {
break;
}
@ -5247,6 +5519,11 @@ void Expr::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_
from._internal_column_expr());
break;
}
case kExistsExpr: {
_this->_internal_mutable_exists_expr()->::milvus::proto::plan::ExistsExpr::MergeFrom(
from._internal_exists_expr());
break;
}
case EXPR_NOT_SET: {
break;
}
@ -5275,7 +5552,7 @@ void Expr::InternalSwap(Expr* other) {
::PROTOBUF_NAMESPACE_ID::Metadata Expr::GetMetadata() const {
return ::_pbi::AssignDescriptors(
&descriptor_table_plan_2eproto_getter, &descriptor_table_plan_2eproto_once,
file_level_metadata_plan_2eproto[14]);
file_level_metadata_plan_2eproto[15]);
}
// ===================================================================
@ -5620,7 +5897,7 @@ void VectorANNS::InternalSwap(VectorANNS* other) {
::PROTOBUF_NAMESPACE_ID::Metadata VectorANNS::GetMetadata() const {
return ::_pbi::AssignDescriptors(
&descriptor_table_plan_2eproto_getter, &descriptor_table_plan_2eproto_once,
file_level_metadata_plan_2eproto[15]);
file_level_metadata_plan_2eproto[16]);
}
// ===================================================================
@ -5844,7 +6121,7 @@ void QueryPlanNode::InternalSwap(QueryPlanNode* other) {
::PROTOBUF_NAMESPACE_ID::Metadata QueryPlanNode::GetMetadata() const {
return ::_pbi::AssignDescriptors(
&descriptor_table_plan_2eproto_getter, &descriptor_table_plan_2eproto_once,
file_level_metadata_plan_2eproto[16]);
file_level_metadata_plan_2eproto[17]);
}
// ===================================================================
@ -6249,7 +6526,7 @@ void PlanNode::InternalSwap(PlanNode* other) {
::PROTOBUF_NAMESPACE_ID::Metadata PlanNode::GetMetadata() const {
return ::_pbi::AssignDescriptors(
&descriptor_table_plan_2eproto_getter, &descriptor_table_plan_2eproto_once,
file_level_metadata_plan_2eproto[17]);
file_level_metadata_plan_2eproto[18]);
}
// @@protoc_insertion_point(namespace_scope)
@ -6273,6 +6550,10 @@ template<> PROTOBUF_NOINLINE ::milvus::proto::plan::ColumnExpr*
Arena::CreateMaybeMessage< ::milvus::proto::plan::ColumnExpr >(Arena* arena) {
return Arena::CreateMessageInternal< ::milvus::proto::plan::ColumnExpr >(arena);
}
template<> PROTOBUF_NOINLINE ::milvus::proto::plan::ExistsExpr*
Arena::CreateMaybeMessage< ::milvus::proto::plan::ExistsExpr >(Arena* arena) {
return Arena::CreateMessageInternal< ::milvus::proto::plan::ExistsExpr >(arena);
}
template<> PROTOBUF_NOINLINE ::milvus::proto::plan::ValueExpr*
Arena::CreateMaybeMessage< ::milvus::proto::plan::ValueExpr >(Arena* arena) {
return Arena::CreateMessageInternal< ::milvus::proto::plan::ValueExpr >(arena);

381
internal/core/src/pb/plan.pb.h Executable file → Normal file
View File

@ -73,6 +73,9 @@ extern ColumnInfoDefaultTypeInternal _ColumnInfo_default_instance_;
class CompareExpr;
struct CompareExprDefaultTypeInternal;
extern CompareExprDefaultTypeInternal _CompareExpr_default_instance_;
class ExistsExpr;
struct ExistsExprDefaultTypeInternal;
extern ExistsExprDefaultTypeInternal _ExistsExpr_default_instance_;
class Expr;
struct ExprDefaultTypeInternal;
extern ExprDefaultTypeInternal _Expr_default_instance_;
@ -115,6 +118,7 @@ template<> ::milvus::proto::plan::BinaryRangeExpr* Arena::CreateMaybeMessage<::m
template<> ::milvus::proto::plan::ColumnExpr* Arena::CreateMaybeMessage<::milvus::proto::plan::ColumnExpr>(Arena*);
template<> ::milvus::proto::plan::ColumnInfo* Arena::CreateMaybeMessage<::milvus::proto::plan::ColumnInfo>(Arena*);
template<> ::milvus::proto::plan::CompareExpr* Arena::CreateMaybeMessage<::milvus::proto::plan::CompareExpr>(Arena*);
template<> ::milvus::proto::plan::ExistsExpr* Arena::CreateMaybeMessage<::milvus::proto::plan::ExistsExpr>(Arena*);
template<> ::milvus::proto::plan::Expr* Arena::CreateMaybeMessage<::milvus::proto::plan::Expr>(Arena*);
template<> ::milvus::proto::plan::GenericValue* Arena::CreateMaybeMessage<::milvus::proto::plan::GenericValue>(Arena*);
template<> ::milvus::proto::plan::PlanNode* Arena::CreateMaybeMessage<::milvus::proto::plan::PlanNode>(Arena*);
@ -1028,6 +1032,163 @@ class ColumnExpr final :
};
// -------------------------------------------------------------------
class ExistsExpr final :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:milvus.proto.plan.ExistsExpr) */ {
public:
inline ExistsExpr() : ExistsExpr(nullptr) {}
~ExistsExpr() override;
explicit PROTOBUF_CONSTEXPR ExistsExpr(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized);
ExistsExpr(const ExistsExpr& from);
ExistsExpr(ExistsExpr&& from) noexcept
: ExistsExpr() {
*this = ::std::move(from);
}
inline ExistsExpr& operator=(const ExistsExpr& from) {
CopyFrom(from);
return *this;
}
inline ExistsExpr& operator=(ExistsExpr&& from) noexcept {
if (this == &from) return *this;
if (GetOwningArena() == from.GetOwningArena()
#ifdef PROTOBUF_FORCE_COPY_IN_MOVE
&& GetOwningArena() != nullptr
#endif // !PROTOBUF_FORCE_COPY_IN_MOVE
) {
InternalSwap(&from);
} else {
CopyFrom(from);
}
return *this;
}
static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() {
return GetDescriptor();
}
static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() {
return default_instance().GetMetadata().descriptor;
}
static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() {
return default_instance().GetMetadata().reflection;
}
static const ExistsExpr& default_instance() {
return *internal_default_instance();
}
static inline const ExistsExpr* internal_default_instance() {
return reinterpret_cast<const ExistsExpr*>(
&_ExistsExpr_default_instance_);
}
static constexpr int kIndexInFileMessages =
4;
friend void swap(ExistsExpr& a, ExistsExpr& b) {
a.Swap(&b);
}
inline void Swap(ExistsExpr* other) {
if (other == this) return;
#ifdef PROTOBUF_FORCE_COPY_IN_SWAP
if (GetOwningArena() != nullptr &&
GetOwningArena() == other->GetOwningArena()) {
#else // PROTOBUF_FORCE_COPY_IN_SWAP
if (GetOwningArena() == other->GetOwningArena()) {
#endif // !PROTOBUF_FORCE_COPY_IN_SWAP
InternalSwap(other);
} else {
::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
}
}
void UnsafeArenaSwap(ExistsExpr* other) {
if (other == this) return;
GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena());
InternalSwap(other);
}
// implements Message ----------------------------------------------
ExistsExpr* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final {
return CreateMaybeMessage<ExistsExpr>(arena);
}
using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
void CopyFrom(const ExistsExpr& from);
using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom;
void MergeFrom( const ExistsExpr& from) {
ExistsExpr::MergeImpl(*this, from);
}
private:
static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg);
public:
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
bool IsInitialized() const final;
size_t ByteSizeLong() const final;
const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
uint8_t* _InternalSerialize(
uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
int GetCachedSize() const final { return _impl_._cached_size_.Get(); }
private:
void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned);
void SharedDtor();
void SetCachedSize(int size) const final;
void InternalSwap(ExistsExpr* other);
private:
friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() {
return "milvus.proto.plan.ExistsExpr";
}
protected:
explicit ExistsExpr(::PROTOBUF_NAMESPACE_ID::Arena* arena,
bool is_message_owned = false);
public:
static const ClassData _class_data_;
const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final;
::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final;
// nested types ----------------------------------------------------
// accessors -------------------------------------------------------
enum : int {
kInfoFieldNumber = 1,
};
// .milvus.proto.plan.ColumnInfo info = 1;
bool has_info() const;
private:
bool _internal_has_info() const;
public:
void clear_info();
const ::milvus::proto::plan::ColumnInfo& info() const;
PROTOBUF_NODISCARD ::milvus::proto::plan::ColumnInfo* release_info();
::milvus::proto::plan::ColumnInfo* mutable_info();
void set_allocated_info(::milvus::proto::plan::ColumnInfo* info);
private:
const ::milvus::proto::plan::ColumnInfo& _internal_info() const;
::milvus::proto::plan::ColumnInfo* _internal_mutable_info();
public:
void unsafe_arena_set_allocated_info(
::milvus::proto::plan::ColumnInfo* info);
::milvus::proto::plan::ColumnInfo* unsafe_arena_release_info();
// @@protoc_insertion_point(class_scope:milvus.proto.plan.ExistsExpr)
private:
class _Internal;
template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper;
typedef void InternalArenaConstructable_;
typedef void DestructorSkippable_;
struct Impl_ {
::milvus::proto::plan::ColumnInfo* info_;
mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
};
union { Impl_ _impl_; };
friend struct ::TableStruct_plan_2eproto;
};
// -------------------------------------------------------------------
class ValueExpr final :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:milvus.proto.plan.ValueExpr) */ {
public:
@ -1076,7 +1237,7 @@ class ValueExpr final :
&_ValueExpr_default_instance_);
}
static constexpr int kIndexInFileMessages =
4;
5;
friend void swap(ValueExpr& a, ValueExpr& b) {
a.Swap(&b);
@ -1233,7 +1394,7 @@ class UnaryRangeExpr final :
&_UnaryRangeExpr_default_instance_);
}
static constexpr int kIndexInFileMessages =
5;
6;
friend void swap(UnaryRangeExpr& a, UnaryRangeExpr& b) {
a.Swap(&b);
@ -1421,7 +1582,7 @@ class BinaryRangeExpr final :
&_BinaryRangeExpr_default_instance_);
}
static constexpr int kIndexInFileMessages =
6;
7;
friend void swap(BinaryRangeExpr& a, BinaryRangeExpr& b) {
a.Swap(&b);
@ -1640,7 +1801,7 @@ class CompareExpr final :
&_CompareExpr_default_instance_);
}
static constexpr int kIndexInFileMessages =
7;
8;
friend void swap(CompareExpr& a, CompareExpr& b) {
a.Swap(&b);
@ -1828,7 +1989,7 @@ class TermExpr final :
&_TermExpr_default_instance_);
}
static constexpr int kIndexInFileMessages =
8;
9;
friend void swap(TermExpr& a, TermExpr& b) {
a.Swap(&b);
@ -2005,7 +2166,7 @@ class UnaryExpr final :
&_UnaryExpr_default_instance_);
}
static constexpr int kIndexInFileMessages =
9;
10;
friend void swap(UnaryExpr& a, UnaryExpr& b) {
a.Swap(&b);
@ -2203,7 +2364,7 @@ class BinaryExpr final :
&_BinaryExpr_default_instance_);
}
static constexpr int kIndexInFileMessages =
10;
11;
friend void swap(BinaryExpr& a, BinaryExpr& b) {
a.Swap(&b);
@ -2423,7 +2584,7 @@ class BinaryArithOp final :
&_BinaryArithOp_default_instance_);
}
static constexpr int kIndexInFileMessages =
11;
12;
friend void swap(BinaryArithOp& a, BinaryArithOp& b) {
a.Swap(&b);
@ -2611,7 +2772,7 @@ class BinaryArithExpr final :
&_BinaryArithExpr_default_instance_);
}
static constexpr int kIndexInFileMessages =
12;
13;
friend void swap(BinaryArithExpr& a, BinaryArithExpr& b) {
a.Swap(&b);
@ -2799,7 +2960,7 @@ class BinaryArithOpEvalRangeExpr final :
&_BinaryArithOpEvalRangeExpr_default_instance_);
}
static constexpr int kIndexInFileMessages =
13;
14;
friend void swap(BinaryArithOpEvalRangeExpr& a, BinaryArithOpEvalRangeExpr& b) {
a.Swap(&b);
@ -3024,6 +3185,7 @@ class Expr final :
kBinaryArithExpr = 8,
kValueExpr = 9,
kColumnExpr = 10,
kExistsExpr = 11,
EXPR_NOT_SET = 0,
};
@ -3032,7 +3194,7 @@ class Expr final :
&_Expr_default_instance_);
}
static constexpr int kIndexInFileMessages =
14;
15;
friend void swap(Expr& a, Expr& b) {
a.Swap(&b);
@ -3115,6 +3277,7 @@ class Expr final :
kBinaryArithExprFieldNumber = 8,
kValueExprFieldNumber = 9,
kColumnExprFieldNumber = 10,
kExistsExprFieldNumber = 11,
};
// .milvus.proto.plan.TermExpr term_expr = 1;
bool has_term_expr() const;
@ -3296,6 +3459,24 @@ class Expr final :
::milvus::proto::plan::ColumnExpr* column_expr);
::milvus::proto::plan::ColumnExpr* unsafe_arena_release_column_expr();
// .milvus.proto.plan.ExistsExpr exists_expr = 11;
bool has_exists_expr() const;
private:
bool _internal_has_exists_expr() const;
public:
void clear_exists_expr();
const ::milvus::proto::plan::ExistsExpr& exists_expr() const;
PROTOBUF_NODISCARD ::milvus::proto::plan::ExistsExpr* release_exists_expr();
::milvus::proto::plan::ExistsExpr* mutable_exists_expr();
void set_allocated_exists_expr(::milvus::proto::plan::ExistsExpr* exists_expr);
private:
const ::milvus::proto::plan::ExistsExpr& _internal_exists_expr() const;
::milvus::proto::plan::ExistsExpr* _internal_mutable_exists_expr();
public:
void unsafe_arena_set_allocated_exists_expr(
::milvus::proto::plan::ExistsExpr* exists_expr);
::milvus::proto::plan::ExistsExpr* unsafe_arena_release_exists_expr();
void clear_expr();
ExprCase expr_case() const;
// @@protoc_insertion_point(class_scope:milvus.proto.plan.Expr)
@ -3311,6 +3492,7 @@ class Expr final :
void set_has_binary_arith_expr();
void set_has_value_expr();
void set_has_column_expr();
void set_has_exists_expr();
inline bool has_expr() const;
inline void clear_has_expr();
@ -3332,6 +3514,7 @@ class Expr final :
::milvus::proto::plan::BinaryArithExpr* binary_arith_expr_;
::milvus::proto::plan::ValueExpr* value_expr_;
::milvus::proto::plan::ColumnExpr* column_expr_;
::milvus::proto::plan::ExistsExpr* exists_expr_;
} expr_;
mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
uint32_t _oneof_case_[1];
@ -3390,7 +3573,7 @@ class VectorANNS final :
&_VectorANNS_default_instance_);
}
static constexpr int kIndexInFileMessages =
15;
16;
friend void swap(VectorANNS& a, VectorANNS& b) {
a.Swap(&b);
@ -3605,7 +3788,7 @@ class QueryPlanNode final :
&_QueryPlanNode_default_instance_);
}
static constexpr int kIndexInFileMessages =
16;
17;
friend void swap(QueryPlanNode& a, QueryPlanNode& b) {
a.Swap(&b);
@ -3780,7 +3963,7 @@ class PlanNode final :
&_PlanNode_default_instance_);
}
static constexpr int kIndexInFileMessages =
17;
18;
friend void swap(PlanNode& a, PlanNode& b) {
a.Swap(&b);
@ -4576,6 +4759,100 @@ inline void ColumnExpr::set_allocated_info(::milvus::proto::plan::ColumnInfo* in
// -------------------------------------------------------------------
// ExistsExpr
// .milvus.proto.plan.ColumnInfo info = 1;
inline bool ExistsExpr::_internal_has_info() const {
return this != internal_default_instance() && _impl_.info_ != nullptr;
}
inline bool ExistsExpr::has_info() const {
return _internal_has_info();
}
inline void ExistsExpr::clear_info() {
if (GetArenaForAllocation() == nullptr && _impl_.info_ != nullptr) {
delete _impl_.info_;
}
_impl_.info_ = nullptr;
}
inline const ::milvus::proto::plan::ColumnInfo& ExistsExpr::_internal_info() const {
const ::milvus::proto::plan::ColumnInfo* p = _impl_.info_;
return p != nullptr ? *p : reinterpret_cast<const ::milvus::proto::plan::ColumnInfo&>(
::milvus::proto::plan::_ColumnInfo_default_instance_);
}
inline const ::milvus::proto::plan::ColumnInfo& ExistsExpr::info() const {
// @@protoc_insertion_point(field_get:milvus.proto.plan.ExistsExpr.info)
return _internal_info();
}
inline void ExistsExpr::unsafe_arena_set_allocated_info(
::milvus::proto::plan::ColumnInfo* info) {
if (GetArenaForAllocation() == nullptr) {
delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(_impl_.info_);
}
_impl_.info_ = info;
if (info) {
} else {
}
// @@protoc_insertion_point(field_unsafe_arena_set_allocated:milvus.proto.plan.ExistsExpr.info)
}
inline ::milvus::proto::plan::ColumnInfo* ExistsExpr::release_info() {
::milvus::proto::plan::ColumnInfo* temp = _impl_.info_;
_impl_.info_ = nullptr;
#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE
auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp);
temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp);
if (GetArenaForAllocation() == nullptr) { delete old; }
#else // PROTOBUF_FORCE_COPY_IN_RELEASE
if (GetArenaForAllocation() != nullptr) {
temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp);
}
#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE
return temp;
}
inline ::milvus::proto::plan::ColumnInfo* ExistsExpr::unsafe_arena_release_info() {
// @@protoc_insertion_point(field_release:milvus.proto.plan.ExistsExpr.info)
::milvus::proto::plan::ColumnInfo* temp = _impl_.info_;
_impl_.info_ = nullptr;
return temp;
}
inline ::milvus::proto::plan::ColumnInfo* ExistsExpr::_internal_mutable_info() {
if (_impl_.info_ == nullptr) {
auto* p = CreateMaybeMessage<::milvus::proto::plan::ColumnInfo>(GetArenaForAllocation());
_impl_.info_ = p;
}
return _impl_.info_;
}
inline ::milvus::proto::plan::ColumnInfo* ExistsExpr::mutable_info() {
::milvus::proto::plan::ColumnInfo* _msg = _internal_mutable_info();
// @@protoc_insertion_point(field_mutable:milvus.proto.plan.ExistsExpr.info)
return _msg;
}
inline void ExistsExpr::set_allocated_info(::milvus::proto::plan::ColumnInfo* info) {
::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation();
if (message_arena == nullptr) {
delete _impl_.info_;
}
if (info) {
::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena =
::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena(info);
if (message_arena != submessage_arena) {
info = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
message_arena, info, submessage_arena);
}
} else {
}
_impl_.info_ = info;
// @@protoc_insertion_point(field_set_allocated:milvus.proto.plan.ExistsExpr.info)
}
// -------------------------------------------------------------------
// ValueExpr
// .milvus.proto.plan.GenericValue value = 1;
@ -7308,6 +7585,80 @@ inline ::milvus::proto::plan::ColumnExpr* Expr::mutable_column_expr() {
return _msg;
}
// .milvus.proto.plan.ExistsExpr exists_expr = 11;
inline bool Expr::_internal_has_exists_expr() const {
return expr_case() == kExistsExpr;
}
inline bool Expr::has_exists_expr() const {
return _internal_has_exists_expr();
}
inline void Expr::set_has_exists_expr() {
_impl_._oneof_case_[0] = kExistsExpr;
}
inline void Expr::clear_exists_expr() {
if (_internal_has_exists_expr()) {
if (GetArenaForAllocation() == nullptr) {
delete _impl_.expr_.exists_expr_;
}
clear_has_expr();
}
}
inline ::milvus::proto::plan::ExistsExpr* Expr::release_exists_expr() {
// @@protoc_insertion_point(field_release:milvus.proto.plan.Expr.exists_expr)
if (_internal_has_exists_expr()) {
clear_has_expr();
::milvus::proto::plan::ExistsExpr* temp = _impl_.expr_.exists_expr_;
if (GetArenaForAllocation() != nullptr) {
temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp);
}
_impl_.expr_.exists_expr_ = nullptr;
return temp;
} else {
return nullptr;
}
}
inline const ::milvus::proto::plan::ExistsExpr& Expr::_internal_exists_expr() const {
return _internal_has_exists_expr()
? *_impl_.expr_.exists_expr_
: reinterpret_cast< ::milvus::proto::plan::ExistsExpr&>(::milvus::proto::plan::_ExistsExpr_default_instance_);
}
inline const ::milvus::proto::plan::ExistsExpr& Expr::exists_expr() const {
// @@protoc_insertion_point(field_get:milvus.proto.plan.Expr.exists_expr)
return _internal_exists_expr();
}
inline ::milvus::proto::plan::ExistsExpr* Expr::unsafe_arena_release_exists_expr() {
// @@protoc_insertion_point(field_unsafe_arena_release:milvus.proto.plan.Expr.exists_expr)
if (_internal_has_exists_expr()) {
clear_has_expr();
::milvus::proto::plan::ExistsExpr* temp = _impl_.expr_.exists_expr_;
_impl_.expr_.exists_expr_ = nullptr;
return temp;
} else {
return nullptr;
}
}
inline void Expr::unsafe_arena_set_allocated_exists_expr(::milvus::proto::plan::ExistsExpr* exists_expr) {
clear_expr();
if (exists_expr) {
set_has_exists_expr();
_impl_.expr_.exists_expr_ = exists_expr;
}
// @@protoc_insertion_point(field_unsafe_arena_set_allocated:milvus.proto.plan.Expr.exists_expr)
}
inline ::milvus::proto::plan::ExistsExpr* Expr::_internal_mutable_exists_expr() {
if (!_internal_has_exists_expr()) {
clear_expr();
set_has_exists_expr();
_impl_.expr_.exists_expr_ = CreateMaybeMessage< ::milvus::proto::plan::ExistsExpr >(GetArenaForAllocation());
}
return _impl_.expr_.exists_expr_;
}
inline ::milvus::proto::plan::ExistsExpr* Expr::mutable_exists_expr() {
::milvus::proto::plan::ExistsExpr* _msg = _internal_mutable_exists_expr();
// @@protoc_insertion_point(field_mutable:milvus.proto.plan.Expr.exists_expr)
return _msg;
}
inline bool Expr::has_expr() const {
return expr_case() != EXPR_NOT_SET;
}
@ -8024,6 +8375,8 @@ inline PlanNode::NodeCase PlanNode::node_case() const {
// -------------------------------------------------------------------
// -------------------------------------------------------------------
// @@protoc_insertion_point(namespace_scope)

View File

@ -119,15 +119,16 @@ struct LogicalBinaryExpr : BinaryExprBase {
};
struct TermExpr : Expr {
const FieldId field_id_;
const DataType data_type_;
const ColumnInfo column_;
const proto::plan::GenericValue::ValCase val_case_;
protected:
// prevent accidental instantiation
TermExpr() = delete;
TermExpr(const FieldId field_id, const DataType data_type)
: field_id_(field_id), data_type_(data_type) {
TermExpr(ColumnInfo column,
const proto::plan::GenericValue::ValCase val_case)
: column_(std::move(column)), val_case_(val_case) {
}
public:
@ -192,18 +193,18 @@ static const std::map<std::string, OpType> mapping_ = {
};
struct UnaryRangeExpr : Expr {
const FieldId field_id_;
const DataType data_type_;
ColumnInfo column_;
const OpType op_type_;
const proto::plan::GenericValue::ValCase val_case_;
protected:
// prevent accidental instantiation
UnaryRangeExpr() = delete;
UnaryRangeExpr(const FieldId field_id,
const DataType data_type,
const OpType op_type)
: field_id_(field_id), data_type_(data_type), op_type_(op_type) {
UnaryRangeExpr(ColumnInfo column,
const OpType op_type,
const proto::plan::GenericValue::ValCase val_case)
: column_(std::move(column)), op_type_(op_type), val_case_(val_case) {
}
public:
@ -248,4 +249,19 @@ struct CompareExpr : Expr {
accept(ExprVisitor&) override;
};
struct ExistsExpr : Expr {
const ColumnInfo column_;
protected:
// prevent accidental instantiation
ExistsExpr() = delete;
ExistsExpr(ColumnInfo column) : column_(std::move(column)) {
}
public:
void
accept(ExprVisitor&) override;
};
} // namespace milvus::query

View File

@ -30,10 +30,10 @@ template <typename T>
struct TermExprImpl : TermExpr {
const std::vector<T> terms_;
TermExprImpl(const FieldId field_id,
const DataType data_type,
const std::vector<T>& terms)
: TermExpr(field_id, data_type), terms_(terms) {
TermExprImpl(ColumnInfo column,
const std::vector<T>& terms,
const proto::plan::GenericValue::ValCase val_case)
: TermExpr(std::forward<ColumnInfo>(column), val_case), terms_(terms) {
}
};
@ -60,11 +60,12 @@ template <typename T>
struct UnaryRangeExprImpl : UnaryRangeExpr {
const T value_;
UnaryRangeExprImpl(const FieldId field_id,
const DataType data_type,
UnaryRangeExprImpl(ColumnInfo column,
const OpType op_type,
const T value)
: UnaryRangeExpr(field_id, data_type, op_type), value_(value) {
const T value,
const proto::plan::GenericValue::ValCase val_case)
: UnaryRangeExpr(std::forward<ColumnInfo>(column), op_type, val_case),
value_(value) {
}
};
@ -88,4 +89,10 @@ struct BinaryRangeExprImpl : BinaryRangeExpr {
}
};
struct ExistsExprImpl : ExistsExpr {
ExistsExprImpl(ColumnInfo column)
: ExistsExpr(std::forward<ColumnInfo>(column)) {
}
};
} // namespace milvus::query

View File

@ -220,23 +220,29 @@ Parser::ParseTermNodeImpl(const FieldName& field_name, const Json& body) {
auto values = body["values"];
std::vector<T> terms(values.size());
auto val_case = proto::plan::GenericValue::ValCase::VAL_NOT_SET;
for (int i = 0; i < values.size(); i++) {
auto value = values[i];
if constexpr (std::is_same_v<T, bool>) {
Assert(value.is_boolean());
val_case = proto::plan::GenericValue::ValCase::kBoolVal;
} else if constexpr (std::is_integral_v<T>) {
Assert(value.is_number_integer());
val_case = proto::plan::GenericValue::ValCase::kInt64Val;
} else if constexpr (std::is_floating_point_v<T>) {
Assert(value.is_number());
val_case = proto::plan::GenericValue::ValCase::kFloatVal;
} else {
static_assert(always_false<T>, "unsupported type");
}
terms[i] = value;
}
std::sort(terms.begin(), terms.end());
return std::make_unique<TermExprImpl<T>>(schema.get_field_id(field_name),
schema[field_name].get_data_type(),
terms);
return std::make_unique<TermExprImpl<T>>(
ColumnInfo(schema.get_field_id(field_name),
schema[field_name].get_data_type()),
terms,
val_case);
}
template <typename T>
@ -323,10 +329,11 @@ Parser::ParseRangeNodeImpl(const FieldName& field_name, const Json& body) {
static_assert(always_false<T>, "unsupported type");
}
return std::make_unique<UnaryRangeExprImpl<T>>(
schema.get_field_id(field_name),
schema[field_name].get_data_type(),
ColumnInfo(schema.get_field_id(field_name),
schema[field_name].get_data_type()),
mapping_.at(op_name),
item.value());
item.value(),
proto::plan::GenericValue::ValCase::VAL_NOT_SET);
} else if (body.size() == 2) {
bool has_lower_value = false;
bool has_upper_value = false;

View File

@ -34,26 +34,32 @@ ExtractTermExprImpl(FieldId field_id,
static_assert(IsScalar<T>);
auto size = expr_proto.values_size();
std::vector<T> terms(size);
auto val_case = proto::plan::GenericValue::ValCase::VAL_NOT_SET;
for (int i = 0; i < size; ++i) {
auto& value_proto = expr_proto.values(i);
if constexpr (std::is_same_v<T, bool>) {
Assert(value_proto.val_case() == planpb::GenericValue::kBoolVal);
terms[i] = static_cast<T>(value_proto.bool_val());
val_case = proto::plan::GenericValue::ValCase::kBoolVal;
} else if constexpr (std::is_integral_v<T>) {
Assert(value_proto.val_case() == planpb::GenericValue::kInt64Val);
terms[i] = static_cast<T>(value_proto.int64_val());
val_case = proto::plan::GenericValue::ValCase::kInt64Val;
} else if constexpr (std::is_floating_point_v<T>) {
Assert(value_proto.val_case() == planpb::GenericValue::kFloatVal);
terms[i] = static_cast<T>(value_proto.float_val());
val_case = proto::plan::GenericValue::ValCase::kFloatVal;
} else if constexpr (std::is_same_v<T, std::string>) {
Assert(value_proto.val_case() == planpb::GenericValue::kStringVal);
terms[i] = static_cast<T>(value_proto.string_val());
val_case = proto::plan::GenericValue::ValCase::kStringVal;
} else {
static_assert(always_false<T>);
}
}
std::sort(terms.begin(), terms.end());
return std::make_unique<TermExprImpl<T>>(field_id, data_type, terms);
return std::make_unique<TermExprImpl<T>>(
expr_proto.column_info(), terms, val_case);
}
template <typename T>
@ -80,10 +86,10 @@ ExtractUnaryRangeExprImpl(FieldId field_id,
}
};
return std::make_unique<UnaryRangeExprImpl<T>>(
field_id,
data_type,
expr_proto.column_info(),
static_cast<OpType>(expr_proto.op()),
getValue(expr_proto.value()));
getValue(expr_proto.value()),
expr_proto.value().val_case());
}
template <typename T>
@ -296,6 +302,26 @@ ProtoParser::ParseUnaryRangeExpr(const proto::plan::UnaryRangeExpr& expr_pb) {
return ExtractUnaryRangeExprImpl<std::string>(
field_id, data_type, expr_pb);
}
case DataType::JSON: {
switch (expr_pb.value().val_case()) {
case proto::plan::GenericValue::ValCase::kBoolVal:
return ExtractUnaryRangeExprImpl<bool>(
field_id, data_type, expr_pb);
case proto::plan::GenericValue::ValCase::kFloatVal:
return ExtractUnaryRangeExprImpl<double>(
field_id, data_type, expr_pb);
case proto::plan::GenericValue::ValCase::kInt64Val:
return ExtractUnaryRangeExprImpl<int64_t>(
field_id, data_type, expr_pb);
case proto::plan::GenericValue::ValCase::kStringVal:
return ExtractUnaryRangeExprImpl<std::string>(
field_id, data_type, expr_pb);
default:
PanicInfo(
fmt::format("unknown data type: {} in expression",
expr_pb.value().val_case()));
}
}
default: {
PanicInfo("unsupported data type");
}
@ -437,6 +463,30 @@ ProtoParser::ParseTermExpr(const proto::plan::TermExpr& expr_pb) {
return ExtractTermExprImpl<std::string>(
field_id, data_type, expr_pb);
}
case DataType::JSON: {
if (expr_pb.values().size() == 0) {
return ExtractTermExprImpl<bool>(
field_id, data_type, expr_pb);
}
switch (expr_pb.values()[0].val_case()) {
case proto::plan::GenericValue::ValCase::kBoolVal:
return ExtractTermExprImpl<bool>(
field_id, data_type, expr_pb);
case proto::plan::GenericValue::ValCase::kFloatVal:
return ExtractTermExprImpl<double>(
field_id, data_type, expr_pb);
case proto::plan::GenericValue::ValCase::kInt64Val:
return ExtractTermExprImpl<int64_t>(
field_id, data_type, expr_pb);
case proto::plan::GenericValue::ValCase::kStringVal:
return ExtractTermExprImpl<std::string>(
field_id, data_type, expr_pb);
default:
PanicInfo(
fmt::format("unknown data type: {} in expression",
expr_pb.values()[0].val_case()));
}
}
default: {
PanicInfo("unsupported data type");
}
@ -517,6 +567,31 @@ ProtoParser::ParseBinaryArithOpEvalRangeExpr(
return result;
}
std::unique_ptr<ExistsExprImpl>
ExtractExistsExprImpl(const proto::plan::ExistsExpr& expr_proto) {
return std::make_unique<ExistsExprImpl>(expr_proto.info());
}
ExprPtr
ProtoParser::ParseExistExpr(const proto::plan::ExistsExpr& expr_pb) {
auto& column_info = expr_pb.info();
auto field_id = FieldId(column_info.field_id());
auto data_type = schema[field_id].get_data_type();
Assert(data_type == static_cast<DataType>(column_info.data_type()));
auto result = [&]() -> ExprPtr {
switch (data_type) {
case DataType::JSON: {
return ExtractExistsExprImpl(expr_pb);
}
default: {
PanicInfo("unsupported data type");
}
}
}();
return result;
}
ExprPtr
ProtoParser::ParseExpr(const proto::plan::Expr& expr_pb) {
using ppe = proto::plan::Expr;
@ -543,6 +618,9 @@ ProtoParser::ParseExpr(const proto::plan::Expr& expr_pb) {
return ParseBinaryArithOpEvalRangeExpr(
expr_pb.binary_arith_op_eval_range_expr());
}
case ppe::kExistsExpr: {
return ParseExistExpr(expr_pb.exists_expr());
}
default:
PanicInfo("unsupported expr proto node");
}

View File

@ -51,6 +51,9 @@ class ProtoParser {
ExprPtr
ParseBinaryExpr(const proto::plan::BinaryExpr& expr_pb);
ExprPtr
ParseExistExpr(const proto::plan::ExistsExpr& expr_pb);
ExprPtr
ParseExpr(const proto::plan::Expr& expr_pb);

View File

@ -45,6 +45,9 @@ class ExecExprVisitor : public ExprVisitor {
void
visit(CompareExpr& expr) override;
void
visit(ExistsExpr& expr) override;
public:
ExecExprVisitor(const segcore::SegmentInternalInterface& segment,
int64_t row_count,
@ -79,6 +82,10 @@ class ExecExprVisitor : public ExprVisitor {
auto
ExecUnaryRangeVisitorDispatcher(UnaryRangeExpr& expr_raw) -> BitsetType;
template <typename ExprValueType>
auto
ExecUnaryRangeVisitorDispatcherJson(UnaryRangeExpr& expr_raw) -> BitsetType;
template <typename ExprValueType>
auto
ExecBinaryArithOpEvalRangeVisitorDispatcherJson(
@ -106,6 +113,10 @@ class ExecExprVisitor : public ExprVisitor {
auto
ExecTermVisitorImplTemplate(TermExpr& expr_raw) -> BitsetType;
template <typename ExprValueType>
auto
ExecTermVisitorImplTemplateJson(TermExpr& expr_raw) -> BitsetType;
template <typename CmpFunc>
auto
ExecCompareExprDispatcher(CompareExpr& expr, CmpFunc cmp_func)

View File

@ -49,4 +49,9 @@ CompareExpr::accept(ExprVisitor& visitor) {
visitor.visit(*this);
}
void
ExistsExpr::accept(ExprVisitor& visitor) {
visitor.visit(*this);
}
} // namespace milvus::query

View File

@ -39,5 +39,8 @@ class ExprVisitor {
virtual void
visit(CompareExpr&) = 0;
virtual void
visit(ExistsExpr&) = 0;
};
} // namespace milvus::query

View File

@ -39,6 +39,9 @@ class ExtractInfoExprVisitor : public ExprVisitor {
void
visit(CompareExpr& expr) override;
void
visit(ExistsExpr& expr) override;
public:
explicit ExtractInfoExprVisitor(ExtractedPlanInfo& plan_info)
: plan_info_(plan_info) {

View File

@ -40,6 +40,9 @@ class ShowExprVisitor : public ExprVisitor {
void
visit(CompareExpr& expr) override;
void
visit(ExistsExpr& expr) override;
public:
Json

View File

@ -44,6 +44,9 @@ class VerifyExprVisitor : public ExprVisitor {
void
visit(CompareExpr& expr) override;
void
visit(ExistsExpr& expr) override;
public:
};
} // namespace milvus::query

View File

@ -287,54 +287,49 @@ ExecExprVisitor::ExecUnaryRangeVisitorDispatcher(UnaryRangeExpr& expr_raw)
auto op = expr.op_type_;
auto val = IndexInnerType(expr.value_);
auto field_id = expr.column_.field_id;
switch (op) {
case OpType::Equal: {
auto index_func = [val](Index* index) {
return index->In(1, &val);
};
auto elem_func = [val](T x) { return (x == val); };
return ExecRangeVisitorImpl<T>(
expr.field_id_, index_func, elem_func);
return ExecRangeVisitorImpl<T>(field_id, index_func, elem_func);
}
case OpType::NotEqual: {
auto index_func = [val](Index* index) {
return index->NotIn(1, &val);
};
auto elem_func = [val](T x) { return (x != val); };
return ExecRangeVisitorImpl<T>(
expr.field_id_, index_func, elem_func);
return ExecRangeVisitorImpl<T>(field_id, index_func, elem_func);
}
case OpType::GreaterEqual: {
auto index_func = [val](Index* index) {
return index->Range(val, OpType::GreaterEqual);
};
auto elem_func = [val](T x) { return (x >= val); };
return ExecRangeVisitorImpl<T>(
expr.field_id_, index_func, elem_func);
return ExecRangeVisitorImpl<T>(field_id, index_func, elem_func);
}
case OpType::GreaterThan: {
auto index_func = [val](Index* index) {
return index->Range(val, OpType::GreaterThan);
};
auto elem_func = [val](T x) { return (x > val); };
return ExecRangeVisitorImpl<T>(
expr.field_id_, index_func, elem_func);
return ExecRangeVisitorImpl<T>(field_id, index_func, elem_func);
}
case OpType::LessEqual: {
auto index_func = [val](Index* index) {
return index->Range(val, OpType::LessEqual);
};
auto elem_func = [val](T x) { return (x <= val); };
return ExecRangeVisitorImpl<T>(
expr.field_id_, index_func, elem_func);
return ExecRangeVisitorImpl<T>(field_id, index_func, elem_func);
}
case OpType::LessThan: {
auto index_func = [val](Index* index) {
return index->Range(val, OpType::LessThan);
};
auto elem_func = [val](T x) { return (x < val); };
return ExecRangeVisitorImpl<T>(
expr.field_id_, index_func, elem_func);
return ExecRangeVisitorImpl<T>(field_id, index_func, elem_func);
}
case OpType::PrefixMatch: {
auto index_func = [val](Index* index) {
@ -344,8 +339,7 @@ ExecExprVisitor::ExecUnaryRangeVisitorDispatcher(UnaryRangeExpr& expr_raw)
return index->Query(std::move(dataset));
};
auto elem_func = [val, op](T x) { return Match(x, val, op); };
return ExecRangeVisitorImpl<T>(
expr.field_id_, index_func, elem_func);
return ExecRangeVisitorImpl<T>(field_id, index_func, elem_func);
}
// TODO: PostfixMatch
default: {
@ -355,6 +349,131 @@ ExecExprVisitor::ExecUnaryRangeVisitorDispatcher(UnaryRangeExpr& expr_raw)
}
#pragma clang diagnostic pop
template <typename ExprValueType>
auto
ExecExprVisitor::ExecUnaryRangeVisitorDispatcherJson(UnaryRangeExpr& expr_raw)
-> BitsetType {
using Index = index::ScalarIndex<milvus::Json>;
auto& expr = static_cast<UnaryRangeExprImpl<ExprValueType>&>(expr_raw);
auto op = expr.op_type_;
auto val = expr.value_;
auto& nested_path = expr.column_.nested_path;
auto field_id = expr.column_.field_id;
auto index_func = [=](Index* index) { return TargetBitmapPtr{}; };
switch (op) {
case OpType::Equal: {
auto elem_func = [val, nested_path](const milvus::Json& json) {
using GetType = std::conditional_t<
std::is_same_v<ExprValueType, std::string>,
std::string_view,
ExprValueType>;
auto x = json.template at<GetType>(nested_path);
if (x.error()) {
return false;
}
return ExprValueType(x.value()) == val;
};
return ExecRangeVisitorImpl<milvus::Json>(
field_id, index_func, elem_func);
}
case OpType::NotEqual: {
auto elem_func = [val, nested_path](const milvus::Json& json) {
using GetType = std::conditional_t<
std::is_same_v<ExprValueType, std::string>,
std::string_view,
ExprValueType>;
auto x = json.template at<GetType>(nested_path);
if (x.error()) {
return true;
}
return ExprValueType(x.value()) != val;
};
return ExecRangeVisitorImpl<milvus::Json>(
field_id, index_func, elem_func);
}
case OpType::GreaterEqual: {
auto elem_func = [val, nested_path](const milvus::Json& json) {
using GetType = std::conditional_t<
std::is_same_v<ExprValueType, std::string>,
std::string_view,
ExprValueType>;
auto x = json.template at<GetType>(nested_path);
if (x.error()) {
return false;
}
return ExprValueType(x.value()) >= val;
};
return ExecRangeVisitorImpl<milvus::Json>(
field_id, index_func, elem_func);
}
case OpType::GreaterThan: {
auto elem_func = [val, nested_path](const milvus::Json& json) {
using GetType = std::conditional_t<
std::is_same_v<ExprValueType, std::string>,
std::string_view,
ExprValueType>;
auto x = json.template at<GetType>(nested_path);
if (x.error()) {
return false;
}
return ExprValueType(x.value()) > val;
};
return ExecRangeVisitorImpl<milvus::Json>(
field_id, index_func, elem_func);
}
case OpType::LessEqual: {
auto elem_func = [val, nested_path](const milvus::Json& json) {
using GetType = std::conditional_t<
std::is_same_v<ExprValueType, std::string>,
std::string_view,
ExprValueType>;
auto x = json.template at<GetType>(nested_path);
if (x.error()) {
return false;
}
return ExprValueType(x.value()) <= val;
};
return ExecRangeVisitorImpl<milvus::Json>(
field_id, index_func, elem_func);
}
case OpType::LessThan: {
auto elem_func = [val, nested_path](const milvus::Json& json) {
using GetType = std::conditional_t<
std::is_same_v<ExprValueType, std::string>,
std::string_view,
ExprValueType>;
auto x = json.template at<GetType>(nested_path);
if (x.error()) {
return false;
}
return ExprValueType(x.value()) < val;
};
return ExecRangeVisitorImpl<milvus::Json>(
field_id, index_func, elem_func);
}
case OpType::PrefixMatch: {
auto elem_func = [val, op, nested_path](const milvus::Json& json) {
using GetType = std::conditional_t<
std::is_same_v<ExprValueType, std::string>,
std::string_view,
ExprValueType>;
auto x = json.template at<GetType>(nested_path);
if (x.error()) {
return false;
}
return Match(ExprValueType(x.value()), val, op);
};
return ExecRangeVisitorImpl<milvus::Json>(
field_id, index_func, elem_func);
}
// TODO: PostfixMatch
default: {
PanicInfo("unsupported range node");
}
}
}
#pragma clang diagnostic push
#pragma ide diagnostic ignored "Simplify"
template <typename T>
@ -739,6 +858,7 @@ ExecExprVisitor::ExecBinaryRangeVisitorDispatcherJson(BinaryRangeExpr& expr_raw)
bool upper_inclusive = expr.upper_inclusive_;
ExprValueType val1 = expr.lower_value_;
ExprValueType val2 = expr.upper_value_;
auto& nested_path = expr.column_.nested_path;
// no json index now
auto index_func = [=](Index* index) { return TargetBitmapPtr{}; };
@ -753,15 +873,21 @@ ExecExprVisitor::ExecBinaryRangeVisitorDispatcherJson(BinaryRangeExpr& expr_raw)
expr.column_.field_id, index_func, elem_func);
} else if (lower_inclusive && !upper_inclusive) {
auto elem_func = [&](const milvus::Json& json) {
auto x = json.template at<GetType>(expr.column_.nested_path);
auto x = json.template at<GetType>(nested_path);
if (x.error()) {
return false;
}
auto value = x.value();
return !x.error() && (val1 <= value && value < val2);
return val1 <= value && value < val2;
};
return ExecRangeVisitorImpl<milvus::Json>(
expr.column_.field_id, index_func, elem_func);
} else if (!lower_inclusive && upper_inclusive) {
auto elem_func = [&](const milvus::Json& json) {
auto x = json.template at<GetType>(expr.column_.nested_path);
auto x = json.template at<GetType>(nested_path);
if (x.error()) {
return false;
}
auto value = x.value();
return !x.error() && (val1 < value && value <= val2);
};
@ -769,7 +895,10 @@ ExecExprVisitor::ExecBinaryRangeVisitorDispatcherJson(BinaryRangeExpr& expr_raw)
expr.column_.field_id, index_func, elem_func);
} else {
auto elem_func = [&](const milvus::Json& json) {
auto x = json.template at<GetType>(expr.column_.nested_path);
auto x = json.template at<GetType>(nested_path);
if (x.error()) {
return false;
}
auto value = x.value();
return !x.error() && (val1 < value && value < val2);
};
@ -780,11 +909,11 @@ ExecExprVisitor::ExecBinaryRangeVisitorDispatcherJson(BinaryRangeExpr& expr_raw)
void
ExecExprVisitor::visit(UnaryRangeExpr& expr) {
auto& field_meta = segment_.get_schema()[expr.field_id_];
AssertInfo(expr.data_type_ == field_meta.get_data_type(),
auto& field_meta = segment_.get_schema()[expr.column_.field_id];
AssertInfo(expr.column_.data_type == field_meta.get_data_type(),
"[ExecExprVisitor]DataType of expr isn't field_meta data type");
BitsetType res;
switch (expr.data_type_) {
switch (expr.column_.data_type) {
case DataType::BOOL: {
res = ExecUnaryRangeVisitorDispatcher<bool>(expr);
break;
@ -821,8 +950,30 @@ ExecExprVisitor::visit(UnaryRangeExpr& expr) {
}
break;
}
case DataType::JSON: {
switch (expr.val_case_) {
case proto::plan::GenericValue::ValCase::kBoolVal:
res = ExecUnaryRangeVisitorDispatcherJson<bool>(expr);
break;
case proto::plan::GenericValue::ValCase::kInt64Val:
res = ExecUnaryRangeVisitorDispatcherJson<int64_t>(expr);
break;
case proto::plan::GenericValue::ValCase::kFloatVal:
res = ExecUnaryRangeVisitorDispatcherJson<double>(expr);
break;
case proto::plan::GenericValue::ValCase::kStringVal:
res =
ExecUnaryRangeVisitorDispatcherJson<std::string>(expr);
break;
default:
PanicInfo(
fmt::format("unknown data type: {}", expr.val_case_));
}
break;
}
default:
PanicInfo("unsupported");
PanicInfo(fmt::format("unsupported data type: {}",
expr.column_.data_type));
}
AssertInfo(res.size() == row_count_,
"[ExecExprVisitor]Size of results not equal row count");
@ -879,13 +1030,16 @@ ExecExprVisitor::visit(BinaryArithOpEvalRangeExpr& expr) {
break;
}
default: {
PanicInfo("unsupported value type {} in expression");
PanicInfo(
fmt::format("unsupported value type {} in expression",
expr.val_case_));
}
}
break;
}
default:
PanicInfo("unsupported");
PanicInfo(fmt::format("unsupported data type: {}",
expr.column_.data_type));
}
AssertInfo(res.size() == row_count_,
"[ExecExprVisitor]Size of results not equal row count");
@ -955,13 +1109,16 @@ ExecExprVisitor::visit(BinaryRangeExpr& expr) {
break;
}
default: {
PanicInfo("unsupported value type {} in expression");
PanicInfo(
fmt::format("unsupported value type {} in expression",
expr.val_case_));
}
}
break;
}
default:
PanicInfo("unsupported");
PanicInfo(fmt::format("unsupported data type: {}",
expr.column_.data_type));
}
AssertInfo(res.size() == row_count_,
"[ExecExprVisitor]Size of results not equal row count");
@ -1170,7 +1327,7 @@ ExecExprVisitor::ExecCompareExprDispatcher(CompareExpr& expr, Op op)
}
}
default:
PanicInfo("unsupported datatype");
PanicInfo(fmt::format("unsupported data type: {}", type));
}
};
auto left = getChunkData(
@ -1252,7 +1409,7 @@ ExecExprVisitor::ExecTermVisitorImpl(TermExpr& expr_raw) -> BitsetType {
auto& expr = static_cast<TermExprImpl<T>&>(expr_raw);
auto& schema = segment_.get_schema();
auto primary_filed_id = schema.get_primary_field_id();
auto field_id = expr_raw.field_id_;
auto field_id = expr_raw.column_.field_id;
auto& field_meta = schema[field_id];
bool use_pk_index = false;
@ -1333,7 +1490,8 @@ ExecExprVisitor::ExecTermVisitorImplTemplate(TermExpr& expr_raw) -> BitsetType {
return term_set.find(x) != term_set.end();
};
return ExecRangeVisitorImpl<T>(expr.field_id_, index_func, elem_func);
return ExecRangeVisitorImpl<T>(
expr.column_.field_id, index_func, elem_func);
}
// TODO: bool is so ugly here.
@ -1365,17 +1523,52 @@ ExecExprVisitor::ExecTermVisitorImplTemplate<bool>(TermExpr& expr_raw)
return term_set.find(x) != term_set.end();
};
return ExecRangeVisitorImpl<T>(expr.field_id_, index_func, elem_func);
return ExecRangeVisitorImpl<T>(
expr.column_.field_id, index_func, elem_func);
}
template <typename ExprValueType>
auto
ExecExprVisitor::ExecTermVisitorImplTemplateJson(TermExpr& expr_raw)
-> BitsetType {
using Index = index::ScalarIndex<milvus::Json>;
auto& expr = static_cast<TermExprImpl<ExprValueType>&>(expr_raw);
auto& nested_path = expr.column_.nested_path;
auto index_func = [=](Index* index) { return TargetBitmapPtr{}; };
std::unordered_set<ExprValueType> term_set(expr.terms_.begin(),
expr.terms_.end());
if (term_set.empty()) {
auto elem_func = [=](const milvus::Json& json) { return false; };
return ExecRangeVisitorImpl<milvus::Json>(
expr.column_.field_id, index_func, elem_func);
}
auto elem_func = [&term_set, nested_path](const milvus::Json& json) {
using GetType =
std::conditional_t<std::is_same_v<ExprValueType, std::string>,
std::string_view,
ExprValueType>;
auto x = json.template at<GetType>(nested_path);
if (x.error()) {
return false;
}
return term_set.find(ExprValueType(x.value())) != term_set.end();
};
return ExecRangeVisitorImpl<milvus::Json>(
expr.column_.field_id, index_func, elem_func);
}
void
ExecExprVisitor::visit(TermExpr& expr) {
auto& field_meta = segment_.get_schema()[expr.field_id_];
AssertInfo(expr.data_type_ == field_meta.get_data_type(),
auto& field_meta = segment_.get_schema()[expr.column_.field_id];
AssertInfo(expr.column_.data_type == field_meta.get_data_type(),
"[ExecExprVisitor]DataType of expr isn't field_meta "
"data type ");
BitsetType res;
switch (expr.data_type_) {
switch (expr.column_.data_type) {
case DataType::BOOL: {
res = ExecTermVisitorImpl<bool>(expr);
break;
@ -1412,11 +1605,64 @@ ExecExprVisitor::visit(TermExpr& expr) {
}
break;
}
case DataType::JSON: {
switch (expr.val_case_) {
case proto::plan::GenericValue::ValCase::kBoolVal:
res = ExecTermVisitorImplTemplateJson<bool>(expr);
break;
case proto::plan::GenericValue::ValCase::kInt64Val:
res = ExecTermVisitorImplTemplateJson<int64_t>(expr);
break;
case proto::plan::GenericValue::ValCase::kFloatVal:
res = ExecTermVisitorImplTemplateJson<double>(expr);
break;
case proto::plan::GenericValue::ValCase::kStringVal:
res = ExecTermVisitorImplTemplateJson<std::string>(expr);
break;
case proto::plan::GenericValue::ValCase::VAL_NOT_SET:
res = ExecTermVisitorImplTemplateJson<bool>(expr);
break;
default:
PanicInfo(
fmt::format("unknown data type: {}", expr.val_case_));
}
break;
}
default:
PanicInfo("unsupported");
PanicInfo(fmt::format("unsupported data type: {}",
expr.column_.data_type));
}
AssertInfo(res.size() == row_count_,
"[ExecExprVisitor]Size of results not equal row count");
bitset_opt_ = std::move(res);
}
void
ExecExprVisitor::visit(ExistsExpr& expr) {
auto& field_meta = segment_.get_schema()[expr.column_.field_id];
AssertInfo(expr.column_.data_type == field_meta.get_data_type(),
"[ExecExprVisitor]DataType of expr isn't field_meta data type");
BitsetType res;
auto& nested_path = expr.column_.nested_path;
switch (expr.column_.data_type) {
case DataType::JSON: {
using Index = index::ScalarIndex<milvus::Json>;
auto index_func = [=](Index* index) { return TargetBitmapPtr{}; };
auto elem_func = [nested_path](const milvus::Json& json) {
auto x = json.exist(nested_path);
return x;
};
res = ExecRangeVisitorImpl<milvus::Json>(
expr.column_.field_id, index_func, elem_func);
break;
}
default:
PanicInfo(fmt::format("unsupported data type {}",
expr.column_.data_type));
}
AssertInfo(res.size() == row_count_,
"[ExecExprVisitor]Size of results not equal row count");
bitset_opt_ = std::move(res);
}
} // namespace milvus::query

View File

@ -41,12 +41,12 @@ ExtractInfoExprVisitor::visit(LogicalBinaryExpr& expr) {
void
ExtractInfoExprVisitor::visit(TermExpr& expr) {
plan_info_.add_involved_field(expr.field_id_);
plan_info_.add_involved_field(expr.column_.field_id);
}
void
ExtractInfoExprVisitor::visit(UnaryRangeExpr& expr) {
plan_info_.add_involved_field(expr.field_id_);
plan_info_.add_involved_field(expr.column_.field_id);
}
void
@ -65,4 +65,9 @@ ExtractInfoExprVisitor::visit(BinaryArithOpEvalRangeExpr& expr) {
plan_info_.add_involved_field(expr.column_.field_id);
}
void
ExtractInfoExprVisitor::visit(ExistsExpr& expr) {
plan_info_.add_involved_field(expr.column_.field_id);
}
} // namespace milvus::query

View File

@ -113,10 +113,10 @@ void
ShowExprVisitor::visit(TermExpr& expr) {
AssertInfo(!json_opt_.has_value(),
"[ShowExprVisitor]Ret json already has value before visit");
AssertInfo(datatype_is_vector(expr.data_type_) == false,
AssertInfo(datatype_is_vector(expr.column_.data_type) == false,
"[ShowExprVisitor]Data type of expr isn't vector type");
auto terms = [&] {
switch (expr.data_type_) {
switch (expr.column_.data_type) {
case DataType::BOOL:
return TermExtract<bool>(expr);
case DataType::INT8:
@ -131,14 +131,16 @@ ShowExprVisitor::visit(TermExpr& expr) {
return TermExtract<double>(expr);
case DataType::FLOAT:
return TermExtract<float>(expr);
case DataType::JSON:
return TermExtract<milvus::Json>(expr);
default:
PanicInfo("unsupported type");
}
}();
Json res{{"expr_type", "Term"},
{"field_id", expr.field_id_.get()},
{"data_type", datatype_name(expr.data_type_)},
{"field_id", expr.column_.field_id.get()},
{"data_type", datatype_name(expr.column_.data_type)},
{"terms", std::move(terms)}};
json_opt_ = res;
@ -154,8 +156,8 @@ UnaryRangeExtract(const UnaryRangeExpr& expr_raw) {
expr,
"[ShowExprVisitor]UnaryRangeExpr cast to UnaryRangeExprImpl failed");
Json res{{"expr_type", "UnaryRange"},
{"field_id", expr->field_id_.get()},
{"data_type", datatype_name(expr->data_type_)},
{"field_id", expr->column_.field_id.get()},
{"data_type", datatype_name(expr->column_.data_type)},
{"op", OpType_Name(static_cast<OpType>(expr->op_type_))},
{"value", expr->value_}};
return res;
@ -165,9 +167,9 @@ void
ShowExprVisitor::visit(UnaryRangeExpr& expr) {
AssertInfo(!json_opt_.has_value(),
"[ShowExprVisitor]Ret json already has value before visit");
AssertInfo(datatype_is_vector(expr.data_type_) == false,
AssertInfo(datatype_is_vector(expr.column_.data_type) == false,
"[ShowExprVisitor]Data type of expr isn't vector type");
switch (expr.data_type_) {
switch (expr.column_.data_type) {
case DataType::BOOL:
json_opt_ = UnaryRangeExtract<bool>(expr);
return;
@ -189,6 +191,9 @@ ShowExprVisitor::visit(UnaryRangeExpr& expr) {
case DataType::FLOAT:
json_opt_ = UnaryRangeExtract<float>(expr);
return;
case DataType::JSON:
json_opt_ = UnaryRangeExtract<milvus::Json>(expr);
return;
default:
PanicInfo("unsupported type");
}
@ -241,6 +246,9 @@ ShowExprVisitor::visit(BinaryRangeExpr& expr) {
case DataType::FLOAT:
json_opt_ = BinaryRangeExtract<float>(expr);
return;
case DataType::JSON:
json_opt_ = BinaryRangeExtract<milvus::Json>(expr);
return;
default:
PanicInfo("unsupported type");
}
@ -312,9 +320,26 @@ ShowExprVisitor::visit(BinaryArithOpEvalRangeExpr& expr) {
case DataType::FLOAT:
json_opt_ = BinaryArithOpEvalRangeExtract<float>(expr);
return;
case DataType::JSON:
json_opt_ = BinaryArithOpEvalRangeExtract<milvus::Json>(expr);
return;
default:
PanicInfo("unsupported type");
}
}
void
ShowExprVisitor::visit(ExistsExpr& expr) {
using proto::plan::OpType;
using proto::plan::OpType_Name;
AssertInfo(!json_opt_.has_value(),
"[ShowExprVisitor]Ret json already has value before visit");
Json res{{"expr_type", "Exists"},
{"field_id", expr.column_.field_id.get()},
{"data_type", expr.column_.data_type},
{"nested_path", expr.column_.nested_path}};
json_opt_ = res;
}
} // namespace milvus::query

View File

@ -47,4 +47,9 @@ VerifyExprVisitor::visit(CompareExpr& expr) {
// TODO
}
void
VerifyExprVisitor::visit(ExistsExpr& expr) {
// TODO
}
} // namespace milvus::query

View File

@ -410,7 +410,10 @@ TEST(CApiTest, MultiDeleteGrowingSegment) {
auto schema = ((milvus::segcore::Collection*)collection)->get_schema();
auto plan = std::make_unique<query::RetrievePlan>(*schema);
auto term_expr = std::make_unique<query::TermExprImpl<int64_t>>(
FieldId(101), DataType::INT64, retrive_pks);
milvus::query::ColumnInfo(
FieldId(101), DataType::INT64, std::vector<std::string>()),
retrive_pks,
proto::plan::GenericValue::kInt64Val);
plan->plan_node_ = std::make_unique<query::RetrievePlanNode>();
plan->plan_node_->predicate_ = std::move(term_expr);
std::vector<FieldId> target_field_ids{FieldId(100), FieldId(101)};
@ -430,7 +433,10 @@ TEST(CApiTest, MultiDeleteGrowingSegment) {
// retrieve pks = {2}
retrive_pks = {2};
term_expr = std::make_unique<query::TermExprImpl<int64_t>>(
FieldId(101), DataType::INT64, retrive_pks);
milvus::query::ColumnInfo(
FieldId(101), DataType::INT64, std::vector<std::string>()),
retrive_pks,
proto::plan::GenericValue::kInt64Val);
plan->plan_node_->predicate_ = std::move(term_expr);
res = Retrieve(
segment, plan.get(), {}, dataset.timestamps_[N - 1], &retrieve_result);
@ -541,7 +547,10 @@ TEST(CApiTest, MultiDeleteSealedSegment) {
auto schema = ((milvus::segcore::Collection*)collection)->get_schema();
auto plan = std::make_unique<query::RetrievePlan>(*schema);
auto term_expr = std::make_unique<query::TermExprImpl<int64_t>>(
FieldId(101), DataType::INT64, retrive_pks);
milvus::query::ColumnInfo(
FieldId(101), DataType::INT64, std::vector<std::string>()),
retrive_pks,
proto::plan::GenericValue::kInt64Val);
plan->plan_node_ = std::make_unique<query::RetrievePlanNode>();
plan->plan_node_->predicate_ = std::move(term_expr);
std::vector<FieldId> target_field_ids{FieldId(100), FieldId(101)};
@ -561,7 +570,10 @@ TEST(CApiTest, MultiDeleteSealedSegment) {
// retrieve pks = {2}
retrive_pks = {2};
term_expr = std::make_unique<query::TermExprImpl<int64_t>>(
FieldId(101), DataType::INT64, retrive_pks);
milvus::query::ColumnInfo(
FieldId(101), DataType::INT64, std::vector<std::string>()),
retrive_pks,
proto::plan::GenericValue::kInt64Val);
plan->plan_node_->predicate_ = std::move(term_expr);
res = Retrieve(
segment, plan.get(), {}, dataset.timestamps_[N - 1], &retrieve_result);
@ -641,7 +653,10 @@ TEST(CApiTest, DeleteRepeatedPksFromGrowingSegment) {
auto schema = ((milvus::segcore::Collection*)collection)->get_schema();
auto plan = std::make_unique<query::RetrievePlan>(*schema);
auto term_expr = std::make_unique<query::TermExprImpl<int64_t>>(
FieldId(101), DataType::INT64, retrive_row_ids);
milvus::query::ColumnInfo(
FieldId(101), DataType::INT64, std::vector<std::string>()),
retrive_row_ids,
proto::plan::GenericValue::kInt64Val);
plan->plan_node_ = std::make_unique<query::RetrievePlanNode>();
plan->plan_node_->predicate_ = std::move(term_expr);
std::vector<FieldId> target_field_ids{FieldId(100), FieldId(101)};
@ -743,7 +758,10 @@ TEST(CApiTest, DeleteRepeatedPksFromSealedSegment) {
auto schema = ((milvus::segcore::Collection*)collection)->get_schema();
auto plan = std::make_unique<query::RetrievePlan>(*schema);
auto term_expr = std::make_unique<query::TermExprImpl<int64_t>>(
FieldId(101), DataType::INT64, retrive_row_ids);
milvus::query::ColumnInfo(
FieldId(101), DataType::INT64, std::vector<std::string>()),
retrive_row_ids,
proto::plan::GenericValue::kInt64Val);
plan->plan_node_ = std::make_unique<query::RetrievePlanNode>();
plan->plan_node_->predicate_ = std::move(term_expr);
std::vector<FieldId> target_field_ids{FieldId(100), FieldId(101)};
@ -841,7 +859,10 @@ TEST(CApiTest, InsertSamePkAfterDeleteOnGrowingSegment) {
auto schema = ((milvus::segcore::Collection*)collection)->get_schema();
auto plan = std::make_unique<query::RetrievePlan>(*schema);
auto term_expr = std::make_unique<query::TermExprImpl<int64_t>>(
FieldId(101), DataType::INT64, retrive_row_ids);
milvus::query::ColumnInfo(
FieldId(101), DataType::INT64, std::vector<std::string>()),
retrive_row_ids,
proto::plan::GenericValue::kInt64Val);
plan->plan_node_ = std::make_unique<query::RetrievePlanNode>();
plan->plan_node_->predicate_ = std::move(term_expr);
std::vector<FieldId> target_field_ids{FieldId(100), FieldId(101)};
@ -959,7 +980,10 @@ TEST(CApiTest, InsertSamePkAfterDeleteOnSealedSegment) {
auto schema = ((milvus::segcore::Collection*)collection)->get_schema();
auto plan = std::make_unique<query::RetrievePlan>(*schema);
auto term_expr = std::make_unique<query::TermExprImpl<int64_t>>(
FieldId(101), DataType::INT64, retrive_row_ids);
milvus::query::ColumnInfo(
FieldId(101), DataType::INT64, std::vector<std::string>()),
retrive_row_ids,
proto::plan::GenericValue::kInt64Val);
plan->plan_node_ = std::make_unique<query::RetrievePlanNode>();
plan->plan_node_->predicate_ = std::move(term_expr);
std::vector<FieldId> target_field_ids{FieldId(100), FieldId(101)};
@ -1145,7 +1169,10 @@ TEST(CApiTest, RetrieveTestWithExpr) {
// create retrieve plan "age in [0]"
std::vector<int64_t> values(1, 0);
auto term_expr = std::make_unique<query::TermExprImpl<int64_t>>(
FieldId(101), DataType::INT64, values);
milvus::query::ColumnInfo(
FieldId(101), DataType::INT64, std::vector<std::string>()),
values,
proto::plan::GenericValue::kInt64Val);
plan->plan_node_ = std::make_unique<query::RetrievePlanNode>();
plan->plan_node_->predicate_ = std::move(term_expr);
@ -4061,7 +4088,10 @@ TEST(CApiTest, RetriveScalarFieldFromSealedSegmentWithIndex) {
plan->plan_node_ = std::make_unique<query::RetrievePlanNode>();
std::vector<int64_t> retrive_row_ids = {age64_col[0]};
auto term_expr = std::make_unique<query::TermExprImpl<int64_t>>(
i64_fid, DataType::INT64, retrive_row_ids);
milvus::query::ColumnInfo(
i64_fid, DataType::INT64, std::vector<std::string>()),
retrive_row_ids,
proto::plan::GenericValue::kInt64Val);
plan->plan_node_->predicate_ = std::move(term_expr);
std::vector<FieldId> target_field_ids;

View File

@ -431,6 +431,234 @@ TEST(Expr, TestBinaryRangeJSON) {
}
}
TEST(Expr, TestExistsJson) {
using namespace milvus::query;
using namespace milvus::segcore;
struct Testcase {
std::vector<std::string> nested_path;
};
std::vector<Testcase> testcases{
{{"A"}},
{{"int"}},
{{"double"}},
{{"B"}},
};
auto schema = std::make_shared<Schema>();
auto i64_fid = schema->AddDebugField("id", DataType::INT64);
auto json_fid = schema->AddDebugField("json", DataType::JSON);
schema->set_primary_field_id(i64_fid);
auto seg = CreateGrowingSegment(schema, empty_index_meta);
int N = 1000;
std::vector<std::string> json_col;
int num_iters = 100;
for (int iter = 0; iter < num_iters; ++iter) {
auto raw_data = DataGen(schema, N, iter);
auto new_json_col = raw_data.get_col<std::string>(json_fid);
json_col.insert(
json_col.end(), new_json_col.begin(), new_json_col.end());
seg->PreInsert(N);
seg->Insert(iter * N,
N,
raw_data.row_ids_.data(),
raw_data.timestamps_.data(),
raw_data.raw_);
}
auto seg_promote = dynamic_cast<SegmentGrowingImpl*>(seg.get());
ExecExprVisitor visitor(
*seg_promote, seg_promote->get_row_count(), MAX_TIMESTAMP);
for (auto testcase : testcases) {
auto check = [&](bool value) { return value; };
RetrievePlanNode plan;
plan.predicate_ = std::make_unique<ExistsExprImpl>(
ColumnInfo(json_fid, DataType::JSON, testcase.nested_path));
auto final = visitor.call_child(*plan.predicate_.value());
EXPECT_EQ(final.size(), N * num_iters);
for (int i = 0; i < N * num_iters; ++i) {
auto ans = final[i];
auto val = milvus::Json(simdjson::padded_string(json_col[i]))
.exist(testcase.nested_path);
auto ref = check(val);
ASSERT_EQ(ans, ref);
}
}
}
TEST(Expr, TestUnaryRangeJson) {
using namespace milvus::query;
using namespace milvus::segcore;
struct Testcase {
int64_t val;
std::vector<std::string> nested_path;
};
std::vector<Testcase> testcases{
{10, {"int"}},
{20, {"int"}},
{30, {"int"}},
{40, {"int"}},
};
auto schema = std::make_shared<Schema>();
auto i64_fid = schema->AddDebugField("id", DataType::INT64);
auto json_fid = schema->AddDebugField("json", DataType::JSON);
schema->set_primary_field_id(i64_fid);
auto seg = CreateGrowingSegment(schema, empty_index_meta);
int N = 1000;
std::vector<std::string> json_col;
int num_iters = 100;
for (int iter = 0; iter < num_iters; ++iter) {
auto raw_data = DataGen(schema, N, iter);
auto new_json_col = raw_data.get_col<std::string>(json_fid);
json_col.insert(
json_col.end(), new_json_col.begin(), new_json_col.end());
seg->PreInsert(N);
seg->Insert(iter * N,
N,
raw_data.row_ids_.data(),
raw_data.timestamps_.data(),
raw_data.raw_);
}
auto seg_promote = dynamic_cast<SegmentGrowingImpl*>(seg.get());
ExecExprVisitor visitor(
*seg_promote, seg_promote->get_row_count(), MAX_TIMESTAMP);
std::vector<OpType> ops{
OpType::Equal,
OpType::NotEqual,
OpType::GreaterThan,
OpType::GreaterEqual,
OpType::LessThan,
OpType::LessEqual,
};
for (const auto& testcase : testcases) {
auto check = [&](int64_t value) { return value == testcase.val; };
std::function<bool(int64_t)> f = check;
for (auto& op : ops) {
switch (op) {
case OpType::Equal: {
f = [&](int64_t value) { return value == testcase.val; };
break;
}
case OpType::NotEqual: {
f = [&](int64_t value) { return value != testcase.val; };
break;
}
case OpType::GreaterEqual: {
f = [&](int64_t value) { return value >= testcase.val; };
break;
}
case OpType::GreaterThan: {
f = [&](int64_t value) { return value > testcase.val; };
break;
}
case OpType::LessEqual: {
f = [&](int64_t value) { return value <= testcase.val; };
break;
}
case OpType::LessThan: {
f = [&](int64_t value) { return value < testcase.val; };
break;
}
default: {
PanicInfo("unsupported range node");
}
}
RetrievePlanNode plan;
plan.predicate_ = std::make_unique<UnaryRangeExprImpl<int64_t>>(
ColumnInfo(json_fid, DataType::JSON, testcase.nested_path),
op,
testcase.val,
proto::plan::GenericValue::ValCase::kInt64Val);
auto final = visitor.call_child(*plan.predicate_.value());
EXPECT_EQ(final.size(), N * num_iters);
for (int i = 0; i < N * num_iters; ++i) {
auto ans = final[i];
auto val = milvus::Json(simdjson::padded_string(json_col[i]))
.template at<int64_t>(testcase.nested_path)
.value();
auto ref = f(val);
ASSERT_EQ(ans, ref);
}
}
}
}
TEST(Expr, TestTermJson) {
using namespace milvus::query;
using namespace milvus::segcore;
struct Testcase {
std::vector<int64_t> term;
std::vector<std::string> nested_path;
};
std::vector<Testcase> testcases{
{{1, 2, 3, 4}, {"int"}},
{{10, 100, 1000, 10000}, {"int"}},
{{100, 10000, 9999, 444}, {"int"}},
{{23, 42, 66, 17, 25}, {"int"}},
};
auto schema = std::make_shared<Schema>();
auto i64_fid = schema->AddDebugField("id", DataType::INT64);
auto json_fid = schema->AddDebugField("json", DataType::JSON);
schema->set_primary_field_id(i64_fid);
auto seg = CreateGrowingSegment(schema, empty_index_meta);
int N = 1000;
std::vector<std::string> json_col;
int num_iters = 100;
for (int iter = 0; iter < num_iters; ++iter) {
auto raw_data = DataGen(schema, N, iter);
auto new_json_col = raw_data.get_col<std::string>(json_fid);
json_col.insert(
json_col.end(), new_json_col.begin(), new_json_col.end());
seg->PreInsert(N);
seg->Insert(iter * N,
N,
raw_data.row_ids_.data(),
raw_data.timestamps_.data(),
raw_data.raw_);
}
auto seg_promote = dynamic_cast<SegmentGrowingImpl*>(seg.get());
ExecExprVisitor visitor(
*seg_promote, seg_promote->get_row_count(), MAX_TIMESTAMP);
for (auto testcase : testcases) {
auto check = [&](int64_t value) {
std::unordered_set<int64_t> term_set(testcase.term.begin(),
testcase.term.end());
return term_set.find(value) != term_set.end();
};
RetrievePlanNode plan;
plan.predicate_ = std::make_unique<TermExprImpl<int64_t>>(
ColumnInfo(json_fid, DataType::JSON, testcase.nested_path),
testcase.term,
proto::plan::GenericValue::ValCase::kInt64Val);
auto final = visitor.call_child(*plan.predicate_.value());
EXPECT_EQ(final.size(), N * num_iters);
for (int i = 0; i < N * num_iters; ++i) {
auto ans = final[i];
auto val = milvus::Json(simdjson::padded_string(json_col[i]))
.template at<int64_t>(testcase.nested_path)
.value();
auto ref = check(val);
ASSERT_EQ(ans, ref);
}
}
}
TEST(Expr, TestTerm) {
using namespace milvus::query;
using namespace milvus::segcore;
@ -1796,3 +2024,531 @@ TEST(Expr, TestBinaryArithOpEvalRangeWithScalarSortIndex) {
}
}
}
TEST(Expr, TestUnaryRangeWithJSON) {
using namespace milvus::query;
using namespace milvus::segcore;
std::vector<
std::tuple<std::string,
std::function<bool(
std::variant<int64_t, bool, double, std::string_view>)>,
DataType>>
testcases = {
{R"(op: Equal
value: <
bool_val: true
>)",
[](std::variant<int64_t, bool, double, std::string_view> v) {
return std::get<bool>(v);
},
DataType::BOOL},
{R"(op: LessEqual
value: <
int64_val: 1500
>)",
[](std::variant<int64_t, bool, double, std::string_view> v) {
return std::get<int64_t>(v) < 1500;
},
DataType::INT64},
{R"(op: LessEqual
value: <
float_val: 4000
>)",
[](std::variant<int64_t, bool, double, std::string_view> v) {
return std::get<double>(v) <= 4000;
},
DataType::DOUBLE},
{R"(op: GreaterThan
value: <
float_val: 1000
>)",
[](std::variant<int64_t, bool, double, std::string_view> v) {
return std::get<double>(v) > 1000;
},
DataType::DOUBLE},
{R"(op: GreaterEqual
value: <
int64_val: 0
>)",
[](std::variant<int64_t, bool, double, std::string_view> v) {
return std::get<int64_t>(v) >= 0;
},
DataType::INT64},
{R"(op: NotEqual
value: <
bool_val: true
>)",
[](std::variant<int64_t, bool, double, std::string_view> v) {
return !std::get<bool>(v);
},
DataType::BOOL},
{R"(op: Equal
value: <
string_val: "test"
>)",
[](std::variant<int64_t, bool, double, std::string_view> v) {
return std::get<std::string_view>(v) == "test";
},
DataType::STRING},
};
std::string serialized_expr_plan = R"(vector_anns: <
field_id: %1%
predicates: <
unary_range_expr: <
@@@@@
>
>
query_info: <
topk: 10
round_decimal: 3
metric_type: "L2"
search_params: "{\"nprobe\": 10}"
>
placeholder_tag: "$0"
>)";
std::string arith_expr = R"(
column_info: <
field_id: %2%
data_type: %3%
nested_path:"%4%"
>
@@@@)";
auto schema = std::make_shared<Schema>();
auto vec_fid = schema->AddDebugField(
"fakevec", DataType::VECTOR_FLOAT, 16, knowhere::metric::L2);
auto i64_fid = schema->AddDebugField("age64", DataType::INT64);
auto json_fid = schema->AddDebugField("json", DataType::JSON);
schema->set_primary_field_id(i64_fid);
auto seg = CreateGrowingSegment(schema, empty_index_meta);
int N = 1000;
std::vector<std::string> json_col;
int num_iters = 100;
for (int iter = 0; iter < num_iters; ++iter) {
auto raw_data = DataGen(schema, N, iter);
auto new_json_col = raw_data.get_col<std::string>(json_fid);
json_col.insert(
json_col.end(), new_json_col.begin(), new_json_col.end());
seg->PreInsert(N);
seg->Insert(iter * N,
N,
raw_data.row_ids_.data(),
raw_data.timestamps_.data(),
raw_data.raw_);
}
auto seg_promote = dynamic_cast<SegmentGrowingImpl*>(seg.get());
ExecExprVisitor visitor(
*seg_promote, seg_promote->get_row_count(), MAX_TIMESTAMP);
int offset = 0;
for (auto [clause, ref_func, dtype] : testcases) {
auto loc = serialized_expr_plan.find("@@@@@");
auto expr_plan = serialized_expr_plan;
expr_plan.replace(loc, 5, arith_expr);
loc = expr_plan.find("@@@@");
expr_plan.replace(loc, 4, clause);
boost::format expr;
switch (dtype) {
case DataType::BOOL: {
expr =
boost::format(expr_plan) % vec_fid.get() % json_fid.get() %
proto::schema::DataType_Name(int(DataType::JSON)) % "bool";
break;
}
case DataType::INT64: {
expr =
boost::format(expr_plan) % vec_fid.get() % json_fid.get() %
proto::schema::DataType_Name(int(DataType::JSON)) % "int";
break;
}
case DataType::DOUBLE: {
expr = boost::format(expr_plan) % vec_fid.get() %
json_fid.get() %
proto::schema::DataType_Name(int(DataType::JSON)) %
"double";
break;
}
case DataType::STRING: {
expr = boost::format(expr_plan) % vec_fid.get() %
json_fid.get() %
proto::schema::DataType_Name(int(DataType::JSON)) %
"string";
break;
}
default: {
ASSERT_TRUE(false) << "No test case defined for this data type";
}
}
auto unary_plan = translate_text_plan_to_binary_plan(expr.str().data());
auto plan = CreateSearchPlanByExpr(
*schema, unary_plan.data(), unary_plan.size());
auto final = visitor.call_child(*plan->plan_node_->predicate_.value());
EXPECT_EQ(final.size(), N * num_iters);
for (int i = 0; i < N * num_iters; ++i) {
auto ans = final[i];
if (dtype == DataType::BOOL) {
auto val = milvus::Json(simdjson::padded_string(json_col[i]))
.template at<bool>({"bool"})
.value();
auto ref = ref_func(val);
ASSERT_EQ(ans, ref) << clause << "@" << i << "!!" << val;
} else if (dtype == DataType::INT64) {
auto val = milvus::Json(simdjson::padded_string(json_col[i]))
.template at<int64_t>({"int"})
.value();
auto ref = ref_func(val);
ASSERT_EQ(ans, ref) << clause << "@" << i << "!!" << val;
} else if (dtype == DataType::DOUBLE) {
auto val = milvus::Json(simdjson::padded_string(json_col[i]))
.template at<double>({"double"})
.value();
auto ref = ref_func(val);
ASSERT_EQ(ans, ref) << clause << "@" << i << "!!" << val;
} else if (dtype == DataType::STRING) {
auto val = milvus::Json(simdjson::padded_string(json_col[i]))
.template at<std::string_view>({"string"})
.value();
auto ref = ref_func(val);
ASSERT_EQ(ans, ref) << clause << "@" << i << "!!" << val;
} else {
ASSERT_TRUE(false) << "No test case defined for this data type";
}
}
}
}
TEST(Expr, TestTermWithJSON) {
using namespace milvus::query;
using namespace milvus::segcore;
std::vector<
std::tuple<std::string,
std::function<bool(
std::variant<int64_t, bool, double, std::string_view>)>,
DataType>>
testcases = {
{R"(values: <bool_val: true>)",
[](std::variant<int64_t, bool, double, std::string_view> v) {
std::unordered_set<bool> term_set;
term_set = {true, false};
return term_set.find(std::get<bool>(v)) != term_set.end();
},
DataType::BOOL},
{R"(values: <int64_val: 1500>, values: <int64_val: 2048>, values: <int64_val: 3216>)",
[](std::variant<int64_t, bool, double, std::string_view> v) {
std::unordered_set<int64_t> term_set;
term_set = {1500, 2048, 3216};
return term_set.find(std::get<int64_t>(v)) != term_set.end();
},
DataType::INT64},
{R"(values: <float_val: 1500.0>, values: <float_val: 4000>, values: <float_val: 235.14>)",
[](std::variant<int64_t, bool, double, std::string_view> v) {
std::unordered_set<double> term_set;
term_set = {1500.0, 4000, 235.14};
return term_set.find(std::get<double>(v)) != term_set.end();
},
DataType::DOUBLE},
{R"(values: <string_val: "aaa">, values: <string_val: "abc">, values: <string_val: "235.14">)",
[](std::variant<int64_t, bool, double, std::string_view> v) {
std::unordered_set<std::string_view> term_set;
term_set = {"aaa", "abc", "235.14"};
return term_set.find(std::get<std::string_view>(v)) !=
term_set.end();
},
DataType::STRING},
{R"()",
[](std::variant<int64_t, bool, double, std::string_view> v) {
return false;
},
DataType::INT64},
};
std::string serialized_expr_plan = R"(vector_anns: <
field_id: %1%
predicates: <
term_expr: <
@@@@@
>
>
query_info: <
topk: 10
round_decimal: 3
metric_type: "L2"
search_params: "{\"nprobe\": 10}"
>
placeholder_tag: "$0"
>)";
std::string arith_expr = R"(
column_info: <
field_id: %2%
data_type: %3%
nested_path:"%4%"
>
@@@@)";
auto schema = std::make_shared<Schema>();
auto vec_fid = schema->AddDebugField(
"fakevec", DataType::VECTOR_FLOAT, 16, knowhere::metric::L2);
auto i64_fid = schema->AddDebugField("age64", DataType::INT64);
auto json_fid = schema->AddDebugField("json", DataType::JSON);
schema->set_primary_field_id(i64_fid);
auto seg = CreateGrowingSegment(schema, empty_index_meta);
int N = 1000;
std::vector<std::string> json_col;
int num_iters = 100;
for (int iter = 0; iter < num_iters; ++iter) {
auto raw_data = DataGen(schema, N, iter);
auto new_json_col = raw_data.get_col<std::string>(json_fid);
json_col.insert(
json_col.end(), new_json_col.begin(), new_json_col.end());
seg->PreInsert(N);
seg->Insert(iter * N,
N,
raw_data.row_ids_.data(),
raw_data.timestamps_.data(),
raw_data.raw_);
}
auto seg_promote = dynamic_cast<SegmentGrowingImpl*>(seg.get());
ExecExprVisitor visitor(
*seg_promote, seg_promote->get_row_count(), MAX_TIMESTAMP);
int offset = 0;
for (auto [clause, ref_func, dtype] : testcases) {
auto loc = serialized_expr_plan.find("@@@@@");
auto expr_plan = serialized_expr_plan;
expr_plan.replace(loc, 5, arith_expr);
loc = expr_plan.find("@@@@");
expr_plan.replace(loc, 4, clause);
boost::format expr;
switch (dtype) {
case DataType::BOOL: {
expr =
boost::format(expr_plan) % vec_fid.get() % json_fid.get() %
proto::schema::DataType_Name(int(DataType::JSON)) % "bool";
break;
}
case DataType::INT64: {
expr =
boost::format(expr_plan) % vec_fid.get() % json_fid.get() %
proto::schema::DataType_Name(int(DataType::JSON)) % "int";
break;
}
case DataType::DOUBLE: {
expr = boost::format(expr_plan) % vec_fid.get() %
json_fid.get() %
proto::schema::DataType_Name(int(DataType::JSON)) %
"double";
break;
}
case DataType::STRING: {
expr = boost::format(expr_plan) % vec_fid.get() %
json_fid.get() %
proto::schema::DataType_Name(int(DataType::JSON)) %
"string";
break;
}
default: {
ASSERT_TRUE(false) << "No test case defined for this data type";
}
}
auto unary_plan = translate_text_plan_to_binary_plan(expr.str().data());
auto plan = CreateSearchPlanByExpr(
*schema, unary_plan.data(), unary_plan.size());
auto final = visitor.call_child(*plan->plan_node_->predicate_.value());
EXPECT_EQ(final.size(), N * num_iters);
for (int i = 0; i < N * num_iters; ++i) {
auto ans = final[i];
if (dtype == DataType::BOOL) {
auto val = milvus::Json(simdjson::padded_string(json_col[i]))
.template at<bool>({"bool"})
.value();
auto ref = ref_func(val);
ASSERT_EQ(ans, ref) << clause << "@" << i << "!!" << val;
} else if (dtype == DataType::INT64) {
auto val = milvus::Json(simdjson::padded_string(json_col[i]))
.template at<int64_t>({"int"})
.value();
auto ref = ref_func(val);
ASSERT_EQ(ans, ref) << clause << "@" << i << "!!" << val;
} else if (dtype == DataType::DOUBLE) {
auto val = milvus::Json(simdjson::padded_string(json_col[i]))
.template at<double>({"double"})
.value();
auto ref = ref_func(val);
ASSERT_EQ(ans, ref) << clause << "@" << i << "!!" << val;
} else if (dtype == DataType::STRING) {
auto val = milvus::Json(simdjson::padded_string(json_col[i]))
.template at<std::string_view>({"string"})
.value();
auto ref = ref_func(val);
ASSERT_EQ(ans, ref) << clause << "@" << i << "!!" << val;
} else {
ASSERT_TRUE(false) << "No test case defined for this data type";
}
}
}
}
TEST(Expr, TestExistsWithJSON) {
using namespace milvus::query;
using namespace milvus::segcore;
std::vector<std::tuple<std::string, std::function<bool(bool)>, DataType>>
testcases = {
{R"()", [](bool v) { return v; }, DataType::BOOL},
{R"()", [](bool v) { return v; }, DataType::INT64},
{R"()", [](bool v) { return v; }, DataType::STRING},
{R"()", [](bool v) { return v; }, DataType::VARCHAR},
{R"()", [](bool v) { return v; }, DataType::DOUBLE},
};
std::string serialized_expr_plan = R"(vector_anns: <
field_id: %1%
predicates: <
exists_expr: <
@@@@@
>
>
query_info: <
topk: 10
round_decimal: 3
metric_type: "L2"
search_params: "{\"nprobe\": 10}"
>
placeholder_tag: "$0"
>)";
std::string arith_expr = R"(
info: <
field_id: %2%
data_type: %3%
nested_path:"%4%"
>
@@@@)";
auto schema = std::make_shared<Schema>();
auto vec_fid = schema->AddDebugField(
"fakevec", DataType::VECTOR_FLOAT, 16, knowhere::metric::L2);
auto i64_fid = schema->AddDebugField("age64", DataType::INT64);
auto json_fid = schema->AddDebugField("json", DataType::JSON);
schema->set_primary_field_id(i64_fid);
auto seg = CreateGrowingSegment(schema, empty_index_meta);
int N = 1000;
std::vector<std::string> json_col;
int num_iters = 100;
for (int iter = 0; iter < num_iters; ++iter) {
auto raw_data = DataGen(schema, N, iter);
auto new_json_col = raw_data.get_col<std::string>(json_fid);
json_col.insert(
json_col.end(), new_json_col.begin(), new_json_col.end());
seg->PreInsert(N);
seg->Insert(iter * N,
N,
raw_data.row_ids_.data(),
raw_data.timestamps_.data(),
raw_data.raw_);
}
auto seg_promote = dynamic_cast<SegmentGrowingImpl*>(seg.get());
ExecExprVisitor visitor(
*seg_promote, seg_promote->get_row_count(), MAX_TIMESTAMP);
int offset = 0;
for (auto [clause, ref_func, dtype] : testcases) {
auto loc = serialized_expr_plan.find("@@@@@");
auto expr_plan = serialized_expr_plan;
expr_plan.replace(loc, 5, arith_expr);
loc = expr_plan.find("@@@@");
expr_plan.replace(loc, 4, clause);
boost::format expr;
switch (dtype) {
case DataType::BOOL: {
expr =
boost::format(expr_plan) % vec_fid.get() % json_fid.get() %
proto::schema::DataType_Name(int(DataType::JSON)) % "bool";
break;
}
case DataType::INT64: {
expr =
boost::format(expr_plan) % vec_fid.get() % json_fid.get() %
proto::schema::DataType_Name(int(DataType::JSON)) % "int";
break;
}
case DataType::DOUBLE: {
expr = boost::format(expr_plan) % vec_fid.get() %
json_fid.get() %
proto::schema::DataType_Name(int(DataType::JSON)) %
"double";
break;
}
case DataType::STRING: {
expr = boost::format(expr_plan) % vec_fid.get() %
json_fid.get() %
proto::schema::DataType_Name(int(DataType::JSON)) %
"string";
break;
}
case DataType::VARCHAR: {
expr = boost::format(expr_plan) % vec_fid.get() %
json_fid.get() %
proto::schema::DataType_Name(int(DataType::JSON)) %
"varchar";
break;
}
default: {
ASSERT_TRUE(false) << "No test case defined for this data type";
}
}
auto unary_plan = translate_text_plan_to_binary_plan(expr.str().data());
auto plan = CreateSearchPlanByExpr(
*schema, unary_plan.data(), unary_plan.size());
auto final = visitor.call_child(*plan->plan_node_->predicate_.value());
EXPECT_EQ(final.size(), N * num_iters);
for (int i = 0; i < N * num_iters; ++i) {
auto ans = final[i];
if (dtype == DataType::BOOL) {
auto val = milvus::Json(simdjson::padded_string(json_col[i]))
.exist({"bool"});
auto ref = ref_func(val);
ASSERT_EQ(ans, ref) << clause << "@" << i << "!!" << val;
} else if (dtype == DataType::INT64) {
auto val = milvus::Json(simdjson::padded_string(json_col[i]))
.exist({"int"});
auto ref = ref_func(val);
ASSERT_EQ(ans, ref) << clause << "@" << i << "!!" << val;
} else if (dtype == DataType::DOUBLE) {
auto val = milvus::Json(simdjson::padded_string(json_col[i]))
.exist({"double"});
auto ref = ref_func(val);
ASSERT_EQ(ans, ref) << clause << "@" << i << "!!" << val;
} else if (dtype == DataType::STRING) {
auto val = milvus::Json(simdjson::padded_string(json_col[i]))
.exist({"string"});
auto ref = ref_func(val);
ASSERT_EQ(ans, ref) << clause << "@" << i << "!!" << val;
} else if (dtype == DataType::VARCHAR) {
auto val = milvus::Json(simdjson::padded_string(json_col[i]))
.exist({"varchar"});
auto ref = ref_func(val);
ASSERT_EQ(ans, ref) << clause << "@" << i << "!!" << val;
} else {
ASSERT_TRUE(false) << "No test case defined for this data type";
}
}
}
}

View File

@ -11,6 +11,7 @@
#include <gtest/gtest.h>
#include "query/Expr.h"
#include "query/ExprImpl.h"
#include "segcore/ScalarIndex.h"
#include "test_utils/DataGen.h"
@ -67,7 +68,10 @@ TEST(Retrieve, AutoID) {
values.emplace_back(i64_col[choose(i)]);
}
auto term_expr = std::make_unique<query::TermExprImpl<int64_t>>(
fid_64, DataType::INT64, values);
milvus::query::ColumnInfo(
fid_64, DataType::INT64, std::vector<std::string>()),
values,
proto::plan::GenericValue::kInt64Val);
plan->plan_node_ = std::make_unique<query::RetrievePlanNode>();
plan->plan_node_->predicate_ = std::move(term_expr);
std::vector<FieldId> target_fields_id{fid_64, fid_vec};
@ -119,7 +123,10 @@ TEST(Retrieve, AutoID2) {
values.emplace_back(i64_col[choose(i)]);
}
auto term_expr = std::make_unique<query::TermExprImpl<int64_t>>(
fid_64, DataType::INT64, values);
milvus::query::ColumnInfo(
fid_64, DataType::INT64, std::vector<std::string>()),
values,
proto::plan::GenericValue::kInt64Val);
plan->plan_node_ = std::make_unique<query::RetrievePlanNode>();
plan->plan_node_->predicate_ = std::move(term_expr);
std::vector<FieldId> target_offsets{fid_64, fid_vec};
@ -169,7 +176,10 @@ TEST(Retrieve, NotExist) {
}
auto term_expr = std::make_unique<query::TermExprImpl<int64_t>>(
fid_64, DataType::INT64, values);
milvus::query::ColumnInfo(
fid_64, DataType::INT64, std::vector<std::string>()),
values,
proto::plan::GenericValue::kInt64Val);
plan->plan_node_ = std::make_unique<query::RetrievePlanNode>();
plan->plan_node_->predicate_ = std::move(term_expr);
std::vector<FieldId> target_offsets{fid_64, fid_vec};
@ -213,7 +223,10 @@ TEST(Retrieve, Empty) {
values.emplace_back(choose(i));
}
auto term_expr = std::make_unique<query::TermExprImpl<int64_t>>(
fid_64, DataType::INT64, values);
milvus::query::ColumnInfo(
fid_64, DataType::INT64, std::vector<std::string>()),
values,
proto::plan::GenericValue::kInt64Val);
plan->plan_node_ = std::make_unique<query::RetrievePlanNode>();
plan->plan_node_->predicate_ = std::move(term_expr);
std::vector<FieldId> target_offsets{fid_64, fid_vec};
@ -254,7 +267,10 @@ TEST(Retrieve, LargeTimestamp) {
values.emplace_back(i64_col[choose(i)]);
}
auto term_expr = std::make_unique<query::TermExprImpl<int64_t>>(
fid_64, DataType::INT64, values);
milvus::query::ColumnInfo(
fid_64, DataType::INT64, std::vector<std::string>()),
values,
proto::plan::GenericValue::kInt64Val);
plan->plan_node_ = std::make_unique<query::RetrievePlanNode>();
plan->plan_node_->predicate_ = std::move(term_expr);
std::vector<FieldId> target_offsets{fid_64, fid_vec};
@ -315,7 +331,10 @@ TEST(Retrieve, Delete) {
values.emplace_back(i64_col[choose(i)]);
}
auto term_expr = std::make_unique<query::TermExprImpl<int64_t>>(
fid_64, DataType::INT64, values);
milvus::query::ColumnInfo(
fid_64, DataType::INT64, std::vector<std::string>()),
values,
proto::plan::GenericValue::kInt64Val);
plan->plan_node_ = std::make_unique<query::RetrievePlanNode>();
plan->plan_node_->predicate_ = std::move(term_expr);
std::vector<FieldId> target_offsets{fid_ts, fid_64, fid_vec};

View File

@ -316,7 +316,9 @@ DataGen(SchemaPtr schema,
for (int i = 0; i < N / repeat_count; i++) {
auto str = R"({"int":)" + std::to_string(er()) +
R"(,"double":)" +
std::to_string(static_cast<double>(er())) + "}";
std::to_string(static_cast<double>(er())) +
R"(,"string":")" + std::to_string(er()) +
R"(","bool": true)" + "}";
data[i] = str;
}
insert_cols(data, N, field_meta);

View File

@ -1,30 +1,32 @@
grammar Plan;
expr:
IntegerConstant # Integer
| FloatingConstant # Floating
| BooleanConstant # Boolean
| StringLiteral # String
| Identifier # Identifier
| '(' expr ')' # Parens
| expr LIKE StringLiteral # Like
| expr POW expr # Power
| op = (ADD | SUB | BNOT | NOT) expr # Unary
// | '(' typeName ')' expr # Cast
| expr op = (MUL | DIV | MOD) expr # MulDivMod
| expr op = (ADD | SUB) expr # AddSub
| expr op = (SHL | SHR) expr # Shift
| expr op = (IN | NIN) ('[' expr (',' expr)* ','? ']') # Term
| expr op = (IN | NIN) EmptyTerm # EmptyTerm
| expr op1 = (LT | LE) Identifier op2 = (LT | LE) expr # Range
| expr op1 = (GT | GE) Identifier op2 = (GT | GE) expr # ReverseRange
| expr op = (LT | LE | GT | GE) expr # Relational
| expr op = (EQ | NE) expr # Equality
| expr BAND expr # BitAnd
| expr BXOR expr # BitXor
| expr BOR expr # BitOr
| expr AND expr # LogicalAnd
| expr OR expr # LogicalOr;
IntegerConstant # Integer
| FloatingConstant # Floating
| BooleanConstant # Boolean
| StringLiteral # String
| Identifier # Identifier
| JSONIdentifier # JSONIdentifier
| '(' expr ')' # Parens
| expr LIKE StringLiteral # Like
| expr POW expr # Power
| op = (ADD | SUB | BNOT | NOT) expr # Unary
// | '(' typeName ')' expr # Cast
| expr op = (MUL | DIV | MOD) expr # MulDivMod
| expr op = (ADD | SUB) expr # AddSub
| expr op = (SHL | SHR) expr # Shift
| expr op = (IN | NIN) ('[' expr (',' expr)* ','? ']') # Term
| expr op = (IN | NIN) EmptyTerm # EmptyTerm
| expr op1 = (LT | LE) (Identifier | JSONIdentifier) op2 = (LT | LE) expr # Range
| expr op1 = (GT | GE) (Identifier | JSONIdentifier) op2 = (GT | GE) expr # ReverseRange
| expr op = (LT | LE | GT | GE) expr # Relational
| expr op = (EQ | NE) expr # Equality
| expr BAND expr # BitAnd
| expr BXOR expr # BitXor
| expr BOR expr # BitOr
| expr AND expr # LogicalAnd
| expr OR expr # LogicalOr
| EXISTS expr # Exists;
// typeName: ty = (BOOL | INT8 | INT16 | INT32 | INT64 | FLOAT | DOUBLE);
@ -44,6 +46,7 @@ EQ: '==';
NE: '!=';
LIKE: 'like' | 'LIKE';
EXISTS: 'exists' | 'EXISTS';
ADD: '+';
SUB: '-';
@ -82,6 +85,7 @@ FloatingConstant:
Identifier: Nondigit (Nondigit | Digit)*;
StringLiteral: EncodingPrefix? '"' SCharSequence? '"';
JSONIdentifier: Identifier('[' (StringLiteral | IntegerConstant) ']')+;
fragment EncodingPrefix: 'u8' | 'u' | 'U' | 'L';

View File

@ -12,6 +12,7 @@ null
'=='
'!='
null
null
'+'
'-'
'*'
@ -37,6 +38,7 @@ null
null
null
null
null
token symbolic names:
null
@ -52,6 +54,7 @@ GE
EQ
NE
LIKE
EXISTS
ADD
SUB
MUL
@ -75,6 +78,7 @@ IntegerConstant
FloatingConstant
Identifier
StringLiteral
JSONIdentifier
Whitespace
Newline
@ -83,4 +87,4 @@ expr
atn:
[3, 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 2, 16, 9, 3, 2, 2, 2, 16, 10, 3, 2, 2, 2, 16, 14, 3, 2, 2, 2, 17, 85, 3, 2, 2, 2, 18, 19, 12, 18, 2, 2, 19, 20, 7, 20, 2, 2, 20, 84, 5, 2, 2, 19, 21, 22, 12, 16, 2, 2, 22, 23, 9, 3, 2, 2, 23, 84, 5, 2, 2, 17, 24, 25, 12, 15, 2, 2, 25, 26, 9, 4, 2, 2, 26, 84, 5, 2, 2, 16, 27, 28, 12, 14, 2, 2, 28, 29, 9, 5, 2, 2, 29, 84, 5, 2, 2, 15, 30, 31, 12, 11, 2, 2, 31, 32, 9, 6, 2, 2, 32, 33, 7, 36, 2, 2, 33, 34, 9, 6, 2, 2, 34, 84, 5, 2, 2, 12, 35, 36, 12, 10, 2, 2, 36, 37, 9, 7, 2, 2, 37, 38, 7, 36, 2, 2, 38, 39, 9, 7, 2, 2, 39, 84, 5, 2, 2, 11, 40, 41, 12, 9, 2, 2, 41, 42, 9, 8, 2, 2, 42, 84, 5, 2, 2, 10, 43, 44, 12, 8, 2, 2, 44, 45, 9, 9, 2, 2, 45, 84, 5, 2, 2, 9, 46, 47, 12, 7, 2, 2, 47, 48, 7, 23, 2, 2, 48, 84, 5, 2, 2, 8, 49, 50, 12, 6, 2, 2, 50, 51, 7, 25, 2, 2, 51, 84, 5, 2, 2, 7, 52, 53, 12, 5, 2, 2, 53, 54, 7, 24, 2, 2, 54, 84, 5, 2, 2, 6, 55, 56, 12, 4, 2, 2, 56, 57, 7, 26, 2, 2, 57, 84, 5, 2, 2, 5, 58, 59, 12, 3, 2, 2, 59, 60, 7, 27, 2, 2, 60, 84, 5, 2, 2, 4, 61, 62, 12, 19, 2, 2, 62, 63, 7, 14, 2, 2, 63, 84, 7, 37, 2, 2, 64, 65, 12, 13, 2, 2, 65, 66, 9, 10, 2, 2, 66, 67, 7, 5, 2, 2, 67, 72, 5, 2, 2, 2, 68, 69, 7, 6, 2, 2, 69, 71, 5, 2, 2, 2, 70, 68, 3, 2, 2, 2, 71, 74, 3, 2, 2, 2, 72, 70, 3, 2, 2, 2, 72, 73, 3, 2, 2, 2, 73, 76, 3, 2, 2, 2, 74, 72, 3, 2, 2, 2, 75, 77, 7, 6, 2, 2, 76, 75, 3, 2, 2, 2, 76, 77, 3, 2, 2, 2, 77, 78, 3, 2, 2, 2, 78, 79, 7, 7, 2, 2, 79, 84, 3, 2, 2, 2, 80, 81, 12, 12, 2, 2, 81, 82, 9, 10, 2, 2, 82, 84, 7, 32, 2, 2, 83, 18, 3, 2, 2, 2, 83, 21, 3, 2, 2, 2, 83, 24, 3, 2, 2, 2, 83, 27, 3, 2, 2, 2, 83, 30, 3, 2, 2, 2, 83, 35, 3, 2, 2, 2, 83, 40, 3, 2, 2, 2, 83, 43, 3, 2, 2, 2, 83, 46, 3, 2, 2, 2, 83, 49, 3, 2, 2, 2, 83, 52, 3, 2, 2, 2, 83, 55, 3, 2, 2, 2, 83, 58, 3, 2, 2, 2, 83, 61, 3, 2, 2, 2, 83, 64, 3, 2, 2, 2, 83, 80, 3, 2, 2, 2, 84, 87, 3, 2, 2, 2, 85, 83, 3, 2, 2, 2, 85, 86, 3, 2, 2, 2, 86, 3, 3, 2, 2, 2, 87, 85, 3, 2, 2, 2, 7, 16, 72, 76, 83, 85]
[3, 24715, 42794, 33075, 47597, 16764, 15335, 30598, 22884, 3, 41, 92, 4, 2, 9, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 5, 2, 20, 10, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 7, 2, 74, 10, 2, 12, 2, 14, 2, 77, 11, 2, 3, 2, 5, 2, 80, 10, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 7, 2, 87, 10, 2, 12, 2, 14, 2, 90, 11, 2, 3, 2, 2, 3, 2, 3, 2, 2, 12, 4, 2, 16, 17, 29, 30, 3, 2, 18, 20, 3, 2, 16, 17, 3, 2, 22, 23, 3, 2, 8, 9, 4, 2, 37, 37, 39, 39, 3, 2, 10, 11, 3, 2, 8, 11, 3, 2, 12, 13, 3, 2, 31, 32, 2, 116, 2, 19, 3, 2, 2, 2, 4, 5, 8, 2, 1, 2, 5, 20, 7, 35, 2, 2, 6, 20, 7, 36, 2, 2, 7, 20, 7, 34, 2, 2, 8, 20, 7, 38, 2, 2, 9, 20, 7, 37, 2, 2, 10, 20, 7, 39, 2, 2, 11, 12, 7, 3, 2, 2, 12, 13, 5, 2, 2, 2, 13, 14, 7, 4, 2, 2, 14, 20, 3, 2, 2, 2, 15, 16, 9, 2, 2, 2, 16, 20, 5, 2, 2, 18, 17, 18, 7, 15, 2, 2, 18, 20, 5, 2, 2, 3, 19, 4, 3, 2, 2, 2, 19, 6, 3, 2, 2, 2, 19, 7, 3, 2, 2, 2, 19, 8, 3, 2, 2, 2, 19, 9, 3, 2, 2, 2, 19, 10, 3, 2, 2, 2, 19, 11, 3, 2, 2, 2, 19, 15, 3, 2, 2, 2, 19, 17, 3, 2, 2, 2, 20, 88, 3, 2, 2, 2, 21, 22, 12, 19, 2, 2, 22, 23, 7, 21, 2, 2, 23, 87, 5, 2, 2, 20, 24, 25, 12, 17, 2, 2, 25, 26, 9, 3, 2, 2, 26, 87, 5, 2, 2, 18, 27, 28, 12, 16, 2, 2, 28, 29, 9, 4, 2, 2, 29, 87, 5, 2, 2, 17, 30, 31, 12, 15, 2, 2, 31, 32, 9, 5, 2, 2, 32, 87, 5, 2, 2, 16, 33, 34, 12, 12, 2, 2, 34, 35, 9, 6, 2, 2, 35, 36, 9, 7, 2, 2, 36, 37, 9, 6, 2, 2, 37, 87, 5, 2, 2, 13, 38, 39, 12, 11, 2, 2, 39, 40, 9, 8, 2, 2, 40, 41, 9, 7, 2, 2, 41, 42, 9, 8, 2, 2, 42, 87, 5, 2, 2, 12, 43, 44, 12, 10, 2, 2, 44, 45, 9, 9, 2, 2, 45, 87, 5, 2, 2, 11, 46, 47, 12, 9, 2, 2, 47, 48, 9, 10, 2, 2, 48, 87, 5, 2, 2, 10, 49, 50, 12, 8, 2, 2, 50, 51, 7, 24, 2, 2, 51, 87, 5, 2, 2, 9, 52, 53, 12, 7, 2, 2, 53, 54, 7, 26, 2, 2, 54, 87, 5, 2, 2, 8, 55, 56, 12, 6, 2, 2, 56, 57, 7, 25, 2, 2, 57, 87, 5, 2, 2, 7, 58, 59, 12, 5, 2, 2, 59, 60, 7, 27, 2, 2, 60, 87, 5, 2, 2, 6, 61, 62, 12, 4, 2, 2, 62, 63, 7, 28, 2, 2, 63, 87, 5, 2, 2, 5, 64, 65, 12, 20, 2, 2, 65, 66, 7, 14, 2, 2, 66, 87, 7, 38, 2, 2, 67, 68, 12, 14, 2, 2, 68, 69, 9, 11, 2, 2, 69, 70, 7, 5, 2, 2, 70, 75, 5, 2, 2, 2, 71, 72, 7, 6, 2, 2, 72, 74, 5, 2, 2, 2, 73, 71, 3, 2, 2, 2, 74, 77, 3, 2, 2, 2, 75, 73, 3, 2, 2, 2, 75, 76, 3, 2, 2, 2, 76, 79, 3, 2, 2, 2, 77, 75, 3, 2, 2, 2, 78, 80, 7, 6, 2, 2, 79, 78, 3, 2, 2, 2, 79, 80, 3, 2, 2, 2, 80, 81, 3, 2, 2, 2, 81, 82, 7, 7, 2, 2, 82, 87, 3, 2, 2, 2, 83, 84, 12, 13, 2, 2, 84, 85, 9, 11, 2, 2, 85, 87, 7, 33, 2, 2, 86, 21, 3, 2, 2, 2, 86, 24, 3, 2, 2, 2, 86, 27, 3, 2, 2, 2, 86, 30, 3, 2, 2, 2, 86, 33, 3, 2, 2, 2, 86, 38, 3, 2, 2, 2, 86, 43, 3, 2, 2, 2, 86, 46, 3, 2, 2, 2, 86, 49, 3, 2, 2, 2, 86, 52, 3, 2, 2, 2, 86, 55, 3, 2, 2, 2, 86, 58, 3, 2, 2, 2, 86, 61, 3, 2, 2, 2, 86, 64, 3, 2, 2, 2, 86, 67, 3, 2, 2, 2, 86, 83, 3, 2, 2, 2, 87, 90, 3, 2, 2, 2, 88, 86, 3, 2, 2, 2, 88, 89, 3, 2, 2, 2, 89, 3, 3, 2, 2, 2, 90, 88, 3, 2, 2, 2, 7, 19, 75, 79, 86, 88]

View File

@ -10,31 +10,33 @@ GE=9
EQ=10
NE=11
LIKE=12
ADD=13
SUB=14
MUL=15
DIV=16
MOD=17
POW=18
SHL=19
SHR=20
BAND=21
BOR=22
BXOR=23
AND=24
OR=25
BNOT=26
NOT=27
IN=28
NIN=29
EmptyTerm=30
BooleanConstant=31
IntegerConstant=32
FloatingConstant=33
Identifier=34
StringLiteral=35
Whitespace=36
Newline=37
EXISTS=13
ADD=14
SUB=15
MUL=16
DIV=17
MOD=18
POW=19
SHL=20
SHR=21
BAND=22
BOR=23
BXOR=24
AND=25
OR=26
BNOT=27
NOT=28
IN=29
NIN=30
EmptyTerm=31
BooleanConstant=32
IntegerConstant=33
FloatingConstant=34
Identifier=35
StringLiteral=36
JSONIdentifier=37
Whitespace=38
Newline=39
'('=1
')'=2
'['=3
@ -46,17 +48,17 @@ Newline=37
'>='=9
'=='=10
'!='=11
'+'=13
'-'=14
'*'=15
'/'=16
'%'=17
'**'=18
'<<'=19
'>>'=20
'&'=21
'|'=22
'^'=23
'~'=26
'in'=28
'not in'=29
'+'=14
'-'=15
'*'=16
'/'=17
'%'=18
'**'=19
'<<'=20
'>>'=21
'&'=22
'|'=23
'^'=24
'~'=27
'in'=29
'not in'=30

File diff suppressed because one or more lines are too long

View File

@ -10,31 +10,33 @@ GE=9
EQ=10
NE=11
LIKE=12
ADD=13
SUB=14
MUL=15
DIV=16
MOD=17
POW=18
SHL=19
SHR=20
BAND=21
BOR=22
BXOR=23
AND=24
OR=25
BNOT=26
NOT=27
IN=28
NIN=29
EmptyTerm=30
BooleanConstant=31
IntegerConstant=32
FloatingConstant=33
Identifier=34
StringLiteral=35
Whitespace=36
Newline=37
EXISTS=13
ADD=14
SUB=15
MUL=16
DIV=17
MOD=18
POW=19
SHL=20
SHR=21
BAND=22
BOR=23
BXOR=24
AND=25
OR=26
BNOT=27
NOT=28
IN=29
NIN=30
EmptyTerm=31
BooleanConstant=32
IntegerConstant=33
FloatingConstant=34
Identifier=35
StringLiteral=36
JSONIdentifier=37
Whitespace=38
Newline=39
'('=1
')'=2
'['=3
@ -46,17 +48,17 @@ Newline=37
'>='=9
'=='=10
'!='=11
'+'=13
'-'=14
'*'=15
'/'=16
'%'=17
'**'=18
'<<'=19
'>>'=20
'&'=21
'|'=22
'^'=23
'~'=26
'in'=28
'not in'=29
'+'=14
'-'=15
'*'=16
'/'=17
'%'=18
'**'=19
'<<'=20
'>>'=21
'&'=22
'|'=23
'^'=24
'~'=27
'in'=29
'not in'=30

View File

@ -7,6 +7,50 @@ type BasePlanVisitor struct {
*antlr.BaseParseTreeVisitor
}
func (v *BasePlanVisitor) VisitJSONIdentifier(ctx *JSONIdentifierContext) interface{} {
return v.VisitChildren(ctx)
}
func (v *BasePlanVisitor) VisitParens(ctx *ParensContext) interface{} {
return v.VisitChildren(ctx)
}
func (v *BasePlanVisitor) VisitString(ctx *StringContext) interface{} {
return v.VisitChildren(ctx)
}
func (v *BasePlanVisitor) VisitFloating(ctx *FloatingContext) interface{} {
return v.VisitChildren(ctx)
}
func (v *BasePlanVisitor) VisitLogicalOr(ctx *LogicalOrContext) interface{} {
return v.VisitChildren(ctx)
}
func (v *BasePlanVisitor) VisitMulDivMod(ctx *MulDivModContext) interface{} {
return v.VisitChildren(ctx)
}
func (v *BasePlanVisitor) VisitIdentifier(ctx *IdentifierContext) interface{} {
return v.VisitChildren(ctx)
}
func (v *BasePlanVisitor) VisitLike(ctx *LikeContext) interface{} {
return v.VisitChildren(ctx)
}
func (v *BasePlanVisitor) VisitLogicalAnd(ctx *LogicalAndContext) interface{} {
return v.VisitChildren(ctx)
}
func (v *BasePlanVisitor) VisitEquality(ctx *EqualityContext) interface{} {
return v.VisitChildren(ctx)
}
func (v *BasePlanVisitor) VisitBoolean(ctx *BooleanContext) interface{} {
return v.VisitChildren(ctx)
}
func (v *BasePlanVisitor) VisitShift(ctx *ShiftContext) interface{} {
return v.VisitChildren(ctx)
}
@ -23,26 +67,14 @@ func (v *BasePlanVisitor) VisitAddSub(ctx *AddSubContext) interface{} {
return v.VisitChildren(ctx)
}
func (v *BasePlanVisitor) VisitParens(ctx *ParensContext) interface{} {
return v.VisitChildren(ctx)
}
func (v *BasePlanVisitor) VisitRelational(ctx *RelationalContext) interface{} {
return v.VisitChildren(ctx)
}
func (v *BasePlanVisitor) VisitString(ctx *StringContext) interface{} {
return v.VisitChildren(ctx)
}
func (v *BasePlanVisitor) VisitTerm(ctx *TermContext) interface{} {
return v.VisitChildren(ctx)
}
func (v *BasePlanVisitor) VisitFloating(ctx *FloatingContext) interface{} {
return v.VisitChildren(ctx)
}
func (v *BasePlanVisitor) VisitRange(ctx *RangeContext) interface{} {
return v.VisitChildren(ctx)
}
@ -51,27 +83,15 @@ func (v *BasePlanVisitor) VisitUnary(ctx *UnaryContext) interface{} {
return v.VisitChildren(ctx)
}
func (v *BasePlanVisitor) VisitLogicalOr(ctx *LogicalOrContext) interface{} {
return v.VisitChildren(ctx)
}
func (v *BasePlanVisitor) VisitInteger(ctx *IntegerContext) interface{} {
return v.VisitChildren(ctx)
}
func (v *BasePlanVisitor) VisitMulDivMod(ctx *MulDivModContext) interface{} {
return v.VisitChildren(ctx)
}
func (v *BasePlanVisitor) VisitIdentifier(ctx *IdentifierContext) interface{} {
return v.VisitChildren(ctx)
}
func (v *BasePlanVisitor) VisitBitXor(ctx *BitXorContext) interface{} {
return v.VisitChildren(ctx)
}
func (v *BasePlanVisitor) VisitLike(ctx *LikeContext) interface{} {
func (v *BasePlanVisitor) VisitExists(ctx *ExistsContext) interface{} {
return v.VisitChildren(ctx)
}
@ -79,22 +99,10 @@ func (v *BasePlanVisitor) VisitBitAnd(ctx *BitAndContext) interface{} {
return v.VisitChildren(ctx)
}
func (v *BasePlanVisitor) VisitLogicalAnd(ctx *LogicalAndContext) interface{} {
return v.VisitChildren(ctx)
}
func (v *BasePlanVisitor) VisitEmptyTerm(ctx *EmptyTermContext) interface{} {
return v.VisitChildren(ctx)
}
func (v *BasePlanVisitor) VisitEquality(ctx *EqualityContext) interface{} {
return v.VisitChildren(ctx)
}
func (v *BasePlanVisitor) VisitBoolean(ctx *BooleanContext) interface{} {
return v.VisitChildren(ctx)
}
func (v *BasePlanVisitor) VisitPower(ctx *PowerContext) interface{} {
return v.VisitChildren(ctx)
}

View File

@ -14,7 +14,7 @@ var _ = fmt.Printf
var _ = unicode.IsLetter
var serializedLexerAtn = []uint16{
3, 24715, 42794, 33075, 47597, 16764, 15335, 30598, 22884, 2, 39, 444,
3, 24715, 42794, 33075, 47597, 16764, 15335, 30598, 22884, 2, 41, 474,
8, 1, 4, 2, 9, 2, 4, 3, 9, 3, 4, 4, 9, 4, 4, 5, 9, 5, 4, 6, 9, 6, 4, 7,
9, 7, 4, 8, 9, 8, 4, 9, 9, 9, 4, 10, 9, 10, 4, 11, 9, 11, 4, 12, 9, 12,
4, 13, 9, 13, 4, 14, 9, 14, 4, 15, 9, 15, 4, 16, 9, 16, 4, 17, 9, 17, 4,
@ -26,199 +26,213 @@ var serializedLexerAtn = []uint16{
9, 44, 4, 45, 9, 45, 4, 46, 9, 46, 4, 47, 9, 47, 4, 48, 9, 48, 4, 49, 9,
49, 4, 50, 9, 50, 4, 51, 9, 51, 4, 52, 9, 52, 4, 53, 9, 53, 4, 54, 9, 54,
4, 55, 9, 55, 4, 56, 9, 56, 4, 57, 9, 57, 4, 58, 9, 58, 4, 59, 9, 59, 4,
60, 9, 60, 4, 61, 9, 61, 3, 2, 3, 2, 3, 3, 3, 3, 3, 4, 3, 4, 3, 5, 3, 5,
3, 6, 3, 6, 3, 7, 3, 7, 3, 8, 3, 8, 3, 8, 3, 9, 3, 9, 3, 10, 3, 10, 3,
10, 3, 11, 3, 11, 3, 11, 3, 12, 3, 12, 3, 12, 3, 13, 3, 13, 3, 13, 3, 13,
3, 13, 3, 13, 3, 13, 3, 13, 5, 13, 158, 10, 13, 3, 14, 3, 14, 3, 15, 3,
15, 3, 16, 3, 16, 3, 17, 3, 17, 3, 18, 3, 18, 3, 19, 3, 19, 3, 19, 3, 20,
3, 20, 3, 20, 3, 21, 3, 21, 3, 21, 3, 22, 3, 22, 3, 23, 3, 23, 3, 24, 3,
24, 3, 25, 3, 25, 3, 25, 3, 25, 3, 25, 5, 25, 190, 10, 25, 3, 26, 3, 26,
3, 26, 3, 26, 5, 26, 196, 10, 26, 3, 27, 3, 27, 3, 28, 3, 28, 3, 28, 3,
28, 5, 28, 204, 10, 28, 3, 29, 3, 29, 3, 29, 3, 30, 3, 30, 3, 30, 3, 30,
3, 30, 3, 30, 3, 30, 3, 31, 3, 31, 3, 31, 7, 31, 219, 10, 31, 12, 31, 14,
31, 222, 11, 31, 3, 31, 3, 31, 3, 32, 3, 32, 3, 32, 3, 32, 3, 32, 3, 32,
3, 32, 3, 32, 3, 32, 3, 32, 3, 32, 3, 32, 3, 32, 3, 32, 3, 32, 3, 32, 3,
32, 3, 32, 3, 32, 3, 32, 3, 32, 3, 32, 3, 32, 3, 32, 3, 32, 3, 32, 3, 32,
5, 32, 253, 10, 32, 3, 33, 3, 33, 3, 33, 3, 33, 5, 33, 259, 10, 33, 3,
34, 3, 34, 5, 34, 263, 10, 34, 3, 35, 3, 35, 3, 35, 7, 35, 268, 10, 35,
12, 35, 14, 35, 271, 11, 35, 3, 36, 5, 36, 274, 10, 36, 3, 36, 3, 36, 5,
36, 278, 10, 36, 3, 36, 3, 36, 3, 37, 3, 37, 3, 37, 5, 37, 285, 10, 37,
3, 38, 6, 38, 288, 10, 38, 13, 38, 14, 38, 289, 3, 39, 3, 39, 3, 39, 3,
39, 3, 39, 3, 39, 3, 39, 5, 39, 299, 10, 39, 3, 40, 3, 40, 3, 41, 3, 41,
3, 42, 3, 42, 3, 42, 6, 42, 308, 10, 42, 13, 42, 14, 42, 309, 3, 43, 3,
43, 7, 43, 314, 10, 43, 12, 43, 14, 43, 317, 11, 43, 3, 44, 3, 44, 7, 44,
321, 10, 44, 12, 44, 14, 44, 324, 11, 44, 3, 45, 3, 45, 3, 45, 3, 45, 3,
46, 3, 46, 3, 47, 3, 47, 3, 48, 3, 48, 3, 49, 3, 49, 3, 49, 3, 49, 3, 49,
3, 50, 3, 50, 3, 50, 3, 50, 3, 50, 3, 50, 3, 50, 3, 50, 3, 50, 3, 50, 5,
50, 351, 10, 50, 3, 51, 3, 51, 5, 51, 355, 10, 51, 3, 51, 3, 51, 3, 51,
5, 51, 360, 10, 51, 3, 52, 3, 52, 3, 52, 3, 52, 5, 52, 366, 10, 52, 3,
52, 3, 52, 3, 53, 5, 53, 371, 10, 53, 3, 53, 3, 53, 3, 53, 3, 53, 3, 53,
5, 53, 378, 10, 53, 3, 54, 3, 54, 5, 54, 382, 10, 54, 3, 54, 3, 54, 3,
55, 6, 55, 387, 10, 55, 13, 55, 14, 55, 388, 3, 56, 5, 56, 392, 10, 56,
3, 56, 3, 56, 3, 56, 3, 56, 3, 56, 5, 56, 399, 10, 56, 3, 57, 6, 57, 402,
10, 57, 13, 57, 14, 57, 403, 3, 58, 3, 58, 5, 58, 408, 10, 58, 3, 58, 3,
58, 3, 59, 3, 59, 3, 59, 3, 59, 3, 59, 5, 59, 417, 10, 59, 3, 59, 5, 59,
420, 10, 59, 3, 59, 3, 59, 3, 59, 3, 59, 3, 59, 5, 59, 427, 10, 59, 3,
60, 6, 60, 430, 10, 60, 13, 60, 14, 60, 431, 3, 60, 3, 60, 3, 61, 3, 61,
5, 61, 438, 10, 61, 3, 61, 5, 61, 441, 10, 61, 3, 61, 3, 61, 2, 2, 62,
3, 3, 5, 4, 7, 5, 9, 6, 11, 7, 13, 8, 15, 9, 17, 10, 19, 11, 21, 12, 23,
13, 25, 14, 27, 15, 29, 16, 31, 17, 33, 18, 35, 19, 37, 20, 39, 21, 41,
22, 43, 23, 45, 24, 47, 25, 49, 26, 51, 27, 53, 28, 55, 29, 57, 30, 59,
31, 61, 32, 63, 33, 65, 34, 67, 35, 69, 36, 71, 37, 73, 2, 75, 2, 77, 2,
79, 2, 81, 2, 83, 2, 85, 2, 87, 2, 89, 2, 91, 2, 93, 2, 95, 2, 97, 2, 99,
2, 101, 2, 103, 2, 105, 2, 107, 2, 109, 2, 111, 2, 113, 2, 115, 2, 117,
2, 119, 38, 121, 39, 3, 2, 17, 5, 2, 78, 78, 87, 87, 119, 119, 6, 2, 12,
12, 15, 15, 36, 36, 94, 94, 5, 2, 67, 92, 97, 97, 99, 124, 3, 2, 50, 59,
4, 2, 68, 68, 100, 100, 3, 2, 50, 51, 4, 2, 90, 90, 122, 122, 3, 2, 51,
59, 3, 2, 50, 57, 5, 2, 50, 59, 67, 72, 99, 104, 4, 2, 71, 71, 103, 103,
4, 2, 45, 45, 47, 47, 4, 2, 82, 82, 114, 114, 12, 2, 36, 36, 41, 41, 65,
65, 94, 94, 99, 100, 104, 104, 112, 112, 116, 116, 118, 118, 120, 120,
4, 2, 11, 11, 34, 34, 2, 467, 2, 3, 3, 2, 2, 2, 2, 5, 3, 2, 2, 2, 2, 7,
3, 2, 2, 2, 2, 9, 3, 2, 2, 2, 2, 11, 3, 2, 2, 2, 2, 13, 3, 2, 2, 2, 2,
15, 3, 2, 2, 2, 2, 17, 3, 2, 2, 2, 2, 19, 3, 2, 2, 2, 2, 21, 3, 2, 2, 2,
2, 23, 3, 2, 2, 2, 2, 25, 3, 2, 2, 2, 2, 27, 3, 2, 2, 2, 2, 29, 3, 2, 2,
2, 2, 31, 3, 2, 2, 2, 2, 33, 3, 2, 2, 2, 2, 35, 3, 2, 2, 2, 2, 37, 3, 2,
2, 2, 2, 39, 3, 2, 2, 2, 2, 41, 3, 2, 2, 2, 2, 43, 3, 2, 2, 2, 2, 45, 3,
2, 2, 2, 2, 47, 3, 2, 2, 2, 2, 49, 3, 2, 2, 2, 2, 51, 3, 2, 2, 2, 2, 53,
3, 2, 2, 2, 2, 55, 3, 2, 2, 2, 2, 57, 3, 2, 2, 2, 2, 59, 3, 2, 2, 2, 2,
61, 3, 2, 2, 2, 2, 63, 3, 2, 2, 2, 2, 65, 3, 2, 2, 2, 2, 67, 3, 2, 2, 2,
2, 69, 3, 2, 2, 2, 2, 71, 3, 2, 2, 2, 2, 119, 3, 2, 2, 2, 2, 121, 3, 2,
2, 2, 3, 123, 3, 2, 2, 2, 5, 125, 3, 2, 2, 2, 7, 127, 3, 2, 2, 2, 9, 129,
3, 2, 2, 2, 11, 131, 3, 2, 2, 2, 13, 133, 3, 2, 2, 2, 15, 135, 3, 2, 2,
2, 17, 138, 3, 2, 2, 2, 19, 140, 3, 2, 2, 2, 21, 143, 3, 2, 2, 2, 23, 146,
3, 2, 2, 2, 25, 157, 3, 2, 2, 2, 27, 159, 3, 2, 2, 2, 29, 161, 3, 2, 2,
2, 31, 163, 3, 2, 2, 2, 33, 165, 3, 2, 2, 2, 35, 167, 3, 2, 2, 2, 37, 169,
3, 2, 2, 2, 39, 172, 3, 2, 2, 2, 41, 175, 3, 2, 2, 2, 43, 178, 3, 2, 2,
2, 45, 180, 3, 2, 2, 2, 47, 182, 3, 2, 2, 2, 49, 189, 3, 2, 2, 2, 51, 195,
3, 2, 2, 2, 53, 197, 3, 2, 2, 2, 55, 203, 3, 2, 2, 2, 57, 205, 3, 2, 2,
2, 59, 208, 3, 2, 2, 2, 61, 215, 3, 2, 2, 2, 63, 252, 3, 2, 2, 2, 65, 258,
3, 2, 2, 2, 67, 262, 3, 2, 2, 2, 69, 264, 3, 2, 2, 2, 71, 273, 3, 2, 2,
2, 73, 284, 3, 2, 2, 2, 75, 287, 3, 2, 2, 2, 77, 298, 3, 2, 2, 2, 79, 300,
3, 2, 2, 2, 81, 302, 3, 2, 2, 2, 83, 304, 3, 2, 2, 2, 85, 311, 3, 2, 2,
2, 87, 318, 3, 2, 2, 2, 89, 325, 3, 2, 2, 2, 91, 329, 3, 2, 2, 2, 93, 331,
3, 2, 2, 2, 95, 333, 3, 2, 2, 2, 97, 335, 3, 2, 2, 2, 99, 350, 3, 2, 2,
2, 101, 359, 3, 2, 2, 2, 103, 361, 3, 2, 2, 2, 105, 377, 3, 2, 2, 2, 107,
379, 3, 2, 2, 2, 109, 386, 3, 2, 2, 2, 111, 398, 3, 2, 2, 2, 113, 401,
3, 2, 2, 2, 115, 405, 3, 2, 2, 2, 117, 426, 3, 2, 2, 2, 119, 429, 3, 2,
2, 2, 121, 440, 3, 2, 2, 2, 123, 124, 7, 42, 2, 2, 124, 4, 3, 2, 2, 2,
125, 126, 7, 43, 2, 2, 126, 6, 3, 2, 2, 2, 127, 128, 7, 93, 2, 2, 128,
8, 3, 2, 2, 2, 129, 130, 7, 46, 2, 2, 130, 10, 3, 2, 2, 2, 131, 132, 7,
95, 2, 2, 132, 12, 3, 2, 2, 2, 133, 134, 7, 62, 2, 2, 134, 14, 3, 2, 2,
2, 135, 136, 7, 62, 2, 2, 136, 137, 7, 63, 2, 2, 137, 16, 3, 2, 2, 2, 138,
139, 7, 64, 2, 2, 139, 18, 3, 2, 2, 2, 140, 141, 7, 64, 2, 2, 141, 142,
7, 63, 2, 2, 142, 20, 3, 2, 2, 2, 143, 144, 7, 63, 2, 2, 144, 145, 7, 63,
2, 2, 145, 22, 3, 2, 2, 2, 146, 147, 7, 35, 2, 2, 147, 148, 7, 63, 2, 2,
148, 24, 3, 2, 2, 2, 149, 150, 7, 110, 2, 2, 150, 151, 7, 107, 2, 2, 151,
152, 7, 109, 2, 2, 152, 158, 7, 103, 2, 2, 153, 154, 7, 78, 2, 2, 154,
155, 7, 75, 2, 2, 155, 156, 7, 77, 2, 2, 156, 158, 7, 71, 2, 2, 157, 149,
3, 2, 2, 2, 157, 153, 3, 2, 2, 2, 158, 26, 3, 2, 2, 2, 159, 160, 7, 45,
2, 2, 160, 28, 3, 2, 2, 2, 161, 162, 7, 47, 2, 2, 162, 30, 3, 2, 2, 2,
163, 164, 7, 44, 2, 2, 164, 32, 3, 2, 2, 2, 165, 166, 7, 49, 2, 2, 166,
34, 3, 2, 2, 2, 167, 168, 7, 39, 2, 2, 168, 36, 3, 2, 2, 2, 169, 170, 7,
44, 2, 2, 170, 171, 7, 44, 2, 2, 171, 38, 3, 2, 2, 2, 172, 173, 7, 62,
2, 2, 173, 174, 7, 62, 2, 2, 174, 40, 3, 2, 2, 2, 175, 176, 7, 64, 2, 2,
176, 177, 7, 64, 2, 2, 177, 42, 3, 2, 2, 2, 178, 179, 7, 40, 2, 2, 179,
44, 3, 2, 2, 2, 180, 181, 7, 126, 2, 2, 181, 46, 3, 2, 2, 2, 182, 183,
7, 96, 2, 2, 183, 48, 3, 2, 2, 2, 184, 185, 7, 40, 2, 2, 185, 190, 7, 40,
2, 2, 186, 187, 7, 99, 2, 2, 187, 188, 7, 112, 2, 2, 188, 190, 7, 102,
2, 2, 189, 184, 3, 2, 2, 2, 189, 186, 3, 2, 2, 2, 190, 50, 3, 2, 2, 2,
191, 192, 7, 126, 2, 2, 192, 196, 7, 126, 2, 2, 193, 194, 7, 113, 2, 2,
194, 196, 7, 116, 2, 2, 195, 191, 3, 2, 2, 2, 195, 193, 3, 2, 2, 2, 196,
52, 3, 2, 2, 2, 197, 198, 7, 128, 2, 2, 198, 54, 3, 2, 2, 2, 199, 204,
7, 35, 2, 2, 200, 201, 7, 112, 2, 2, 201, 202, 7, 113, 2, 2, 202, 204,
7, 118, 2, 2, 203, 199, 3, 2, 2, 2, 203, 200, 3, 2, 2, 2, 204, 56, 3, 2,
2, 2, 205, 206, 7, 107, 2, 2, 206, 207, 7, 112, 2, 2, 207, 58, 3, 2, 2,
2, 208, 209, 7, 112, 2, 2, 209, 210, 7, 113, 2, 2, 210, 211, 7, 118, 2,
2, 211, 212, 7, 34, 2, 2, 212, 213, 7, 107, 2, 2, 213, 214, 7, 112, 2,
2, 214, 60, 3, 2, 2, 2, 215, 220, 7, 93, 2, 2, 216, 219, 5, 119, 60, 2,
217, 219, 5, 121, 61, 2, 218, 216, 3, 2, 2, 2, 218, 217, 3, 2, 2, 2, 219,
222, 3, 2, 2, 2, 220, 218, 3, 2, 2, 2, 220, 221, 3, 2, 2, 2, 221, 223,
3, 2, 2, 2, 222, 220, 3, 2, 2, 2, 223, 224, 7, 95, 2, 2, 224, 62, 3, 2,
2, 2, 225, 226, 7, 118, 2, 2, 226, 227, 7, 116, 2, 2, 227, 228, 7, 119,
2, 2, 228, 253, 7, 103, 2, 2, 229, 230, 7, 86, 2, 2, 230, 231, 7, 116,
2, 2, 231, 232, 7, 119, 2, 2, 232, 253, 7, 103, 2, 2, 233, 234, 7, 86,
2, 2, 234, 235, 7, 84, 2, 2, 235, 236, 7, 87, 2, 2, 236, 253, 7, 71, 2,
2, 237, 238, 7, 104, 2, 2, 238, 239, 7, 99, 2, 2, 239, 240, 7, 110, 2,
2, 240, 241, 7, 117, 2, 2, 241, 253, 7, 103, 2, 2, 242, 243, 7, 72, 2,
2, 243, 244, 7, 99, 2, 2, 244, 245, 7, 110, 2, 2, 245, 246, 7, 117, 2,
2, 246, 253, 7, 103, 2, 2, 247, 248, 7, 72, 2, 2, 248, 249, 7, 67, 2, 2,
249, 250, 7, 78, 2, 2, 250, 251, 7, 85, 2, 2, 251, 253, 7, 71, 2, 2, 252,
225, 3, 2, 2, 2, 252, 229, 3, 2, 2, 2, 252, 233, 3, 2, 2, 2, 252, 237,
3, 2, 2, 2, 252, 242, 3, 2, 2, 2, 252, 247, 3, 2, 2, 2, 253, 64, 3, 2,
2, 2, 254, 259, 5, 85, 43, 2, 255, 259, 5, 87, 44, 2, 256, 259, 5, 89,
45, 2, 257, 259, 5, 83, 42, 2, 258, 254, 3, 2, 2, 2, 258, 255, 3, 2, 2,
2, 258, 256, 3, 2, 2, 2, 258, 257, 3, 2, 2, 2, 259, 66, 3, 2, 2, 2, 260,
263, 5, 101, 51, 2, 261, 263, 5, 103, 52, 2, 262, 260, 3, 2, 2, 2, 262,
261, 3, 2, 2, 2, 263, 68, 3, 2, 2, 2, 264, 269, 5, 79, 40, 2, 265, 268,
5, 79, 40, 2, 266, 268, 5, 81, 41, 2, 267, 265, 3, 2, 2, 2, 267, 266, 3,
2, 2, 2, 268, 271, 3, 2, 2, 2, 269, 267, 3, 2, 2, 2, 269, 270, 3, 2, 2,
2, 270, 70, 3, 2, 2, 2, 271, 269, 3, 2, 2, 2, 272, 274, 5, 73, 37, 2, 273,
272, 3, 2, 2, 2, 273, 274, 3, 2, 2, 2, 274, 275, 3, 2, 2, 2, 275, 277,
7, 36, 2, 2, 276, 278, 5, 75, 38, 2, 277, 276, 3, 2, 2, 2, 277, 278, 3,
2, 2, 2, 278, 279, 3, 2, 2, 2, 279, 280, 7, 36, 2, 2, 280, 72, 3, 2, 2,
2, 281, 282, 7, 119, 2, 2, 282, 285, 7, 58, 2, 2, 283, 285, 9, 2, 2, 2,
284, 281, 3, 2, 2, 2, 284, 283, 3, 2, 2, 2, 285, 74, 3, 2, 2, 2, 286, 288,
5, 77, 39, 2, 287, 286, 3, 2, 2, 2, 288, 289, 3, 2, 2, 2, 289, 287, 3,
2, 2, 2, 289, 290, 3, 2, 2, 2, 290, 76, 3, 2, 2, 2, 291, 299, 10, 3, 2,
2, 292, 299, 5, 117, 59, 2, 293, 294, 7, 94, 2, 2, 294, 299, 7, 12, 2,
2, 295, 296, 7, 94, 2, 2, 296, 297, 7, 15, 2, 2, 297, 299, 7, 12, 2, 2,
298, 291, 3, 2, 2, 2, 298, 292, 3, 2, 2, 2, 298, 293, 3, 2, 2, 2, 298,
295, 3, 2, 2, 2, 299, 78, 3, 2, 2, 2, 300, 301, 9, 4, 2, 2, 301, 80, 3,
2, 2, 2, 302, 303, 9, 5, 2, 2, 303, 82, 3, 2, 2, 2, 304, 305, 7, 50, 2,
2, 305, 307, 9, 6, 2, 2, 306, 308, 9, 7, 2, 2, 307, 306, 3, 2, 2, 2, 308,
309, 3, 2, 2, 2, 309, 307, 3, 2, 2, 2, 309, 310, 3, 2, 2, 2, 310, 84, 3,
2, 2, 2, 311, 315, 5, 91, 46, 2, 312, 314, 5, 81, 41, 2, 313, 312, 3, 2,
2, 2, 314, 317, 3, 2, 2, 2, 315, 313, 3, 2, 2, 2, 315, 316, 3, 2, 2, 2,
316, 86, 3, 2, 2, 2, 317, 315, 3, 2, 2, 2, 318, 322, 7, 50, 2, 2, 319,
321, 5, 93, 47, 2, 320, 319, 3, 2, 2, 2, 321, 324, 3, 2, 2, 2, 322, 320,
3, 2, 2, 2, 322, 323, 3, 2, 2, 2, 323, 88, 3, 2, 2, 2, 324, 322, 3, 2,
2, 2, 325, 326, 7, 50, 2, 2, 326, 327, 9, 8, 2, 2, 327, 328, 5, 113, 57,
2, 328, 90, 3, 2, 2, 2, 329, 330, 9, 9, 2, 2, 330, 92, 3, 2, 2, 2, 331,
332, 9, 10, 2, 2, 332, 94, 3, 2, 2, 2, 333, 334, 9, 11, 2, 2, 334, 96,
3, 2, 2, 2, 335, 336, 5, 95, 48, 2, 336, 337, 5, 95, 48, 2, 337, 338, 5,
95, 48, 2, 338, 339, 5, 95, 48, 2, 339, 98, 3, 2, 2, 2, 340, 341, 7, 94,
2, 2, 341, 342, 7, 119, 2, 2, 342, 343, 3, 2, 2, 2, 343, 351, 5, 97, 49,
2, 344, 345, 7, 94, 2, 2, 345, 346, 7, 87, 2, 2, 346, 347, 3, 2, 2, 2,
347, 348, 5, 97, 49, 2, 348, 349, 5, 97, 49, 2, 349, 351, 3, 2, 2, 2, 350,
340, 3, 2, 2, 2, 350, 344, 3, 2, 2, 2, 351, 100, 3, 2, 2, 2, 352, 354,
5, 105, 53, 2, 353, 355, 5, 107, 54, 2, 354, 353, 3, 2, 2, 2, 354, 355,
3, 2, 2, 2, 355, 360, 3, 2, 2, 2, 356, 357, 5, 109, 55, 2, 357, 358, 5,
107, 54, 2, 358, 360, 3, 2, 2, 2, 359, 352, 3, 2, 2, 2, 359, 356, 3, 2,
2, 2, 360, 102, 3, 2, 2, 2, 361, 362, 7, 50, 2, 2, 362, 365, 9, 8, 2, 2,
363, 366, 5, 111, 56, 2, 364, 366, 5, 113, 57, 2, 365, 363, 3, 2, 2, 2,
365, 364, 3, 2, 2, 2, 366, 367, 3, 2, 2, 2, 367, 368, 5, 115, 58, 2, 368,
104, 3, 2, 2, 2, 369, 371, 5, 109, 55, 2, 370, 369, 3, 2, 2, 2, 370, 371,
3, 2, 2, 2, 371, 372, 3, 2, 2, 2, 372, 373, 7, 48, 2, 2, 373, 378, 5, 109,
55, 2, 374, 375, 5, 109, 55, 2, 375, 376, 7, 48, 2, 2, 376, 378, 3, 2,
2, 2, 377, 370, 3, 2, 2, 2, 377, 374, 3, 2, 2, 2, 378, 106, 3, 2, 2, 2,
379, 381, 9, 12, 2, 2, 380, 382, 9, 13, 2, 2, 381, 380, 3, 2, 2, 2, 381,
382, 3, 2, 2, 2, 382, 383, 3, 2, 2, 2, 383, 384, 5, 109, 55, 2, 384, 108,
3, 2, 2, 2, 385, 387, 5, 81, 41, 2, 386, 385, 3, 2, 2, 2, 387, 388, 3,
2, 2, 2, 388, 386, 3, 2, 2, 2, 388, 389, 3, 2, 2, 2, 389, 110, 3, 2, 2,
2, 390, 392, 5, 113, 57, 2, 391, 390, 3, 2, 2, 2, 391, 392, 3, 2, 2, 2,
392, 393, 3, 2, 2, 2, 393, 394, 7, 48, 2, 2, 394, 399, 5, 113, 57, 2, 395,
396, 5, 113, 57, 2, 396, 397, 7, 48, 2, 2, 397, 399, 3, 2, 2, 2, 398, 391,
3, 2, 2, 2, 398, 395, 3, 2, 2, 2, 399, 112, 3, 2, 2, 2, 400, 402, 5, 95,
48, 2, 401, 400, 3, 2, 2, 2, 402, 403, 3, 2, 2, 2, 403, 401, 3, 2, 2, 2,
403, 404, 3, 2, 2, 2, 404, 114, 3, 2, 2, 2, 405, 407, 9, 14, 2, 2, 406,
408, 9, 13, 2, 2, 407, 406, 3, 2, 2, 2, 407, 408, 3, 2, 2, 2, 408, 409,
3, 2, 2, 2, 409, 410, 5, 109, 55, 2, 410, 116, 3, 2, 2, 2, 411, 412, 7,
94, 2, 2, 412, 427, 9, 15, 2, 2, 413, 414, 7, 94, 2, 2, 414, 416, 5, 93,
47, 2, 415, 417, 5, 93, 47, 2, 416, 415, 3, 2, 2, 2, 416, 417, 3, 2, 2,
2, 417, 419, 3, 2, 2, 2, 418, 420, 5, 93, 47, 2, 419, 418, 3, 2, 2, 2,
419, 420, 3, 2, 2, 2, 420, 427, 3, 2, 2, 2, 421, 422, 7, 94, 2, 2, 422,
423, 7, 122, 2, 2, 423, 424, 3, 2, 2, 2, 424, 427, 5, 113, 57, 2, 425,
427, 5, 99, 50, 2, 426, 411, 3, 2, 2, 2, 426, 413, 3, 2, 2, 2, 426, 421,
3, 2, 2, 2, 426, 425, 3, 2, 2, 2, 427, 118, 3, 2, 2, 2, 428, 430, 9, 16,
2, 2, 429, 428, 3, 2, 2, 2, 430, 431, 3, 2, 2, 2, 431, 429, 3, 2, 2, 2,
431, 432, 3, 2, 2, 2, 432, 433, 3, 2, 2, 2, 433, 434, 8, 60, 2, 2, 434,
120, 3, 2, 2, 2, 435, 437, 7, 15, 2, 2, 436, 438, 7, 12, 2, 2, 437, 436,
3, 2, 2, 2, 437, 438, 3, 2, 2, 2, 438, 441, 3, 2, 2, 2, 439, 441, 7, 12,
2, 2, 440, 435, 3, 2, 2, 2, 440, 439, 3, 2, 2, 2, 441, 442, 3, 2, 2, 2,
442, 443, 8, 61, 2, 2, 443, 122, 3, 2, 2, 2, 40, 2, 157, 189, 195, 203,
218, 220, 252, 258, 262, 267, 269, 273, 277, 284, 289, 298, 309, 315, 322,
350, 354, 359, 365, 370, 377, 381, 388, 391, 398, 403, 407, 416, 419, 426,
431, 437, 440, 3, 8, 2, 2,
60, 9, 60, 4, 61, 9, 61, 4, 62, 9, 62, 4, 63, 9, 63, 3, 2, 3, 2, 3, 3,
3, 3, 3, 4, 3, 4, 3, 5, 3, 5, 3, 6, 3, 6, 3, 7, 3, 7, 3, 8, 3, 8, 3, 8,
3, 9, 3, 9, 3, 10, 3, 10, 3, 10, 3, 11, 3, 11, 3, 11, 3, 12, 3, 12, 3,
12, 3, 13, 3, 13, 3, 13, 3, 13, 3, 13, 3, 13, 3, 13, 3, 13, 5, 13, 162,
10, 13, 3, 14, 3, 14, 3, 14, 3, 14, 3, 14, 3, 14, 3, 14, 3, 14, 3, 14,
3, 14, 3, 14, 3, 14, 5, 14, 176, 10, 14, 3, 15, 3, 15, 3, 16, 3, 16, 3,
17, 3, 17, 3, 18, 3, 18, 3, 19, 3, 19, 3, 20, 3, 20, 3, 20, 3, 21, 3, 21,
3, 21, 3, 22, 3, 22, 3, 22, 3, 23, 3, 23, 3, 24, 3, 24, 3, 25, 3, 25, 3,
26, 3, 26, 3, 26, 3, 26, 3, 26, 5, 26, 208, 10, 26, 3, 27, 3, 27, 3, 27,
3, 27, 5, 27, 214, 10, 27, 3, 28, 3, 28, 3, 29, 3, 29, 3, 29, 3, 29, 5,
29, 222, 10, 29, 3, 30, 3, 30, 3, 30, 3, 31, 3, 31, 3, 31, 3, 31, 3, 31,
3, 31, 3, 31, 3, 32, 3, 32, 3, 32, 7, 32, 237, 10, 32, 12, 32, 14, 32,
240, 11, 32, 3, 32, 3, 32, 3, 33, 3, 33, 3, 33, 3, 33, 3, 33, 3, 33, 3,
33, 3, 33, 3, 33, 3, 33, 3, 33, 3, 33, 3, 33, 3, 33, 3, 33, 3, 33, 3, 33,
3, 33, 3, 33, 3, 33, 3, 33, 3, 33, 3, 33, 3, 33, 3, 33, 3, 33, 3, 33, 5,
33, 271, 10, 33, 3, 34, 3, 34, 3, 34, 3, 34, 5, 34, 277, 10, 34, 3, 35,
3, 35, 5, 35, 281, 10, 35, 3, 36, 3, 36, 3, 36, 7, 36, 286, 10, 36, 12,
36, 14, 36, 289, 11, 36, 3, 37, 5, 37, 292, 10, 37, 3, 37, 3, 37, 5, 37,
296, 10, 37, 3, 37, 3, 37, 3, 38, 3, 38, 3, 38, 3, 38, 5, 38, 304, 10,
38, 3, 38, 3, 38, 6, 38, 308, 10, 38, 13, 38, 14, 38, 309, 3, 39, 3, 39,
3, 39, 5, 39, 315, 10, 39, 3, 40, 6, 40, 318, 10, 40, 13, 40, 14, 40, 319,
3, 41, 3, 41, 3, 41, 3, 41, 3, 41, 3, 41, 3, 41, 5, 41, 329, 10, 41, 3,
42, 3, 42, 3, 43, 3, 43, 3, 44, 3, 44, 3, 44, 6, 44, 338, 10, 44, 13, 44,
14, 44, 339, 3, 45, 3, 45, 7, 45, 344, 10, 45, 12, 45, 14, 45, 347, 11,
45, 3, 46, 3, 46, 7, 46, 351, 10, 46, 12, 46, 14, 46, 354, 11, 46, 3, 47,
3, 47, 3, 47, 3, 47, 3, 48, 3, 48, 3, 49, 3, 49, 3, 50, 3, 50, 3, 51, 3,
51, 3, 51, 3, 51, 3, 51, 3, 52, 3, 52, 3, 52, 3, 52, 3, 52, 3, 52, 3, 52,
3, 52, 3, 52, 3, 52, 5, 52, 381, 10, 52, 3, 53, 3, 53, 5, 53, 385, 10,
53, 3, 53, 3, 53, 3, 53, 5, 53, 390, 10, 53, 3, 54, 3, 54, 3, 54, 3, 54,
5, 54, 396, 10, 54, 3, 54, 3, 54, 3, 55, 5, 55, 401, 10, 55, 3, 55, 3,
55, 3, 55, 3, 55, 3, 55, 5, 55, 408, 10, 55, 3, 56, 3, 56, 5, 56, 412,
10, 56, 3, 56, 3, 56, 3, 57, 6, 57, 417, 10, 57, 13, 57, 14, 57, 418, 3,
58, 5, 58, 422, 10, 58, 3, 58, 3, 58, 3, 58, 3, 58, 3, 58, 5, 58, 429,
10, 58, 3, 59, 6, 59, 432, 10, 59, 13, 59, 14, 59, 433, 3, 60, 3, 60, 5,
60, 438, 10, 60, 3, 60, 3, 60, 3, 61, 3, 61, 3, 61, 3, 61, 3, 61, 5, 61,
447, 10, 61, 3, 61, 5, 61, 450, 10, 61, 3, 61, 3, 61, 3, 61, 3, 61, 3,
61, 5, 61, 457, 10, 61, 3, 62, 6, 62, 460, 10, 62, 13, 62, 14, 62, 461,
3, 62, 3, 62, 3, 63, 3, 63, 5, 63, 468, 10, 63, 3, 63, 5, 63, 471, 10,
63, 3, 63, 3, 63, 2, 2, 64, 3, 3, 5, 4, 7, 5, 9, 6, 11, 7, 13, 8, 15, 9,
17, 10, 19, 11, 21, 12, 23, 13, 25, 14, 27, 15, 29, 16, 31, 17, 33, 18,
35, 19, 37, 20, 39, 21, 41, 22, 43, 23, 45, 24, 47, 25, 49, 26, 51, 27,
53, 28, 55, 29, 57, 30, 59, 31, 61, 32, 63, 33, 65, 34, 67, 35, 69, 36,
71, 37, 73, 38, 75, 39, 77, 2, 79, 2, 81, 2, 83, 2, 85, 2, 87, 2, 89, 2,
91, 2, 93, 2, 95, 2, 97, 2, 99, 2, 101, 2, 103, 2, 105, 2, 107, 2, 109,
2, 111, 2, 113, 2, 115, 2, 117, 2, 119, 2, 121, 2, 123, 40, 125, 41, 3,
2, 17, 5, 2, 78, 78, 87, 87, 119, 119, 6, 2, 12, 12, 15, 15, 36, 36, 94,
94, 5, 2, 67, 92, 97, 97, 99, 124, 3, 2, 50, 59, 4, 2, 68, 68, 100, 100,
3, 2, 50, 51, 4, 2, 90, 90, 122, 122, 3, 2, 51, 59, 3, 2, 50, 57, 5, 2,
50, 59, 67, 72, 99, 104, 4, 2, 71, 71, 103, 103, 4, 2, 45, 45, 47, 47,
4, 2, 82, 82, 114, 114, 12, 2, 36, 36, 41, 41, 65, 65, 94, 94, 99, 100,
104, 104, 112, 112, 116, 116, 118, 118,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183,
3, 2, 2, 2, 37, 185, 3, 2, 2, 2, 39, 187, 3, 2, 2, 2, 41, 190, 3, 2, 2,
2, 43, 193, 3, 2, 2, 2, 45, 196, 3, 2, 2, 2, 47, 198, 3, 2, 2, 2, 49, 200,
3, 2, 2, 2, 51, 207, 3, 2, 2, 2, 53, 213, 3, 2, 2, 2, 55, 215, 3, 2, 2,
2, 57, 221, 3, 2, 2, 2, 59, 223, 3, 2, 2, 2, 61, 226, 3, 2, 2, 2, 63, 233,
3, 2, 2, 2, 65, 270, 3, 2, 2, 2, 67, 276, 3, 2, 2, 2, 69, 280, 3, 2, 2,
2, 71, 282, 3, 2, 2, 2, 73, 291, 3, 2, 2, 2, 75, 299, 3, 2, 2, 2, 77, 314,
3, 2, 2, 2, 79, 317, 3, 2, 2, 2, 81, 328, 3, 2, 2, 2, 83, 330, 3, 2, 2,
2, 85, 332, 3, 2, 2, 2, 87, 334, 3, 2, 2, 2, 89, 341, 3, 2, 2, 2, 91, 348,
3, 2, 2, 2, 93, 355, 3, 2, 2, 2, 95, 359, 3, 2, 2, 2, 97, 361, 3, 2, 2,
2, 99, 363, 3, 2, 2, 2, 101, 365, 3, 2, 2, 2, 103, 380, 3, 2, 2, 2, 105,
389, 3, 2, 2, 2, 107, 391, 3, 2, 2, 2, 109, 407, 3, 2, 2, 2, 111, 409,
3, 2, 2, 2, 113, 416, 3, 2, 2, 2, 115, 428, 3, 2, 2, 2, 117, 431, 3, 2,
2, 2, 119, 435, 3, 2, 2, 2, 121, 456, 3, 2, 2, 2, 123, 459, 3, 2, 2, 2,
125, 470, 3, 2, 2, 2, 127, 128, 7, 42, 2, 2, 128, 4, 3, 2, 2, 2, 129, 130,
7, 43, 2, 2, 130, 6, 3, 2, 2, 2, 131, 132, 7, 93, 2, 2, 132, 8, 3, 2, 2,
2, 133, 134, 7, 46, 2, 2, 134, 10, 3, 2, 2, 2, 135, 136, 7, 95, 2, 2, 136,
12, 3, 2, 2, 2, 137, 138, 7, 62, 2, 2, 138, 14, 3, 2, 2, 2, 139, 140, 7,
62, 2, 2, 140, 141, 7, 63, 2, 2, 141, 16, 3, 2, 2, 2, 142, 143, 7, 64,
2, 2, 143, 18, 3, 2, 2, 2, 144, 145, 7, 64, 2, 2, 145, 146, 7, 63, 2, 2,
146, 20, 3, 2, 2, 2, 147, 148, 7, 63, 2, 2, 148, 149, 7, 63, 2, 2, 149,
22, 3, 2, 2, 2, 150, 151, 7, 35, 2, 2, 151, 152, 7, 63, 2, 2, 152, 24,
3, 2, 2, 2, 153, 154, 7, 110, 2, 2, 154, 155, 7, 107, 2, 2, 155, 156, 7,
109, 2, 2, 156, 162, 7, 103, 2, 2, 157, 158, 7, 78, 2, 2, 158, 159, 7,
75, 2, 2, 159, 160, 7, 77, 2, 2, 160, 162, 7, 71, 2, 2, 161, 153, 3, 2,
2, 2, 161, 157, 3, 2, 2, 2, 162, 26, 3, 2, 2, 2, 163, 164, 7, 103, 2, 2,
164, 165, 7, 122, 2, 2, 165, 166, 7, 107, 2, 2, 166, 167, 7, 117, 2, 2,
167, 168, 7, 118, 2, 2, 168, 176, 7, 117, 2, 2, 169, 170, 7, 71, 2, 2,
170, 171, 7, 90, 2, 2, 171, 172, 7, 75, 2, 2, 172, 173, 7, 85, 2, 2, 173,
174, 7, 86, 2, 2, 174, 176, 7, 85, 2, 2, 175, 163, 3, 2, 2, 2, 175, 169,
3, 2, 2, 2, 176, 28, 3, 2, 2, 2, 177, 178, 7, 45, 2, 2, 178, 30, 3, 2,
2, 2, 179, 180, 7, 47, 2, 2, 180, 32, 3, 2, 2, 2, 181, 182, 7, 44, 2, 2,
182, 34, 3, 2, 2, 2, 183, 184, 7, 49, 2, 2, 184, 36, 3, 2, 2, 2, 185, 186,
7, 39, 2, 2, 186, 38, 3, 2, 2, 2, 187, 188, 7, 44, 2, 2, 188, 189, 7, 44,
2, 2, 189, 40, 3, 2, 2, 2, 190, 191, 7, 62, 2, 2, 191, 192, 7, 62, 2, 2,
192, 42, 3, 2, 2, 2, 193, 194, 7, 64, 2, 2, 194, 195, 7, 64, 2, 2, 195,
44, 3, 2, 2, 2, 196, 197, 7, 40, 2, 2, 197, 46, 3, 2, 2, 2, 198, 199, 7,
126, 2, 2, 199, 48, 3, 2, 2, 2, 200, 201, 7, 96, 2, 2, 201, 50, 3, 2, 2,
2, 202, 203, 7, 40, 2, 2, 203, 208, 7, 40, 2, 2, 204, 205, 7, 99, 2, 2,
205, 206, 7, 112, 2, 2, 206, 208, 7, 102, 2, 2, 207, 202, 3, 2, 2, 2, 207,
204, 3, 2, 2, 2, 208, 52, 3, 2, 2, 2, 209, 210, 7, 126, 2, 2, 210, 214,
7, 126, 2, 2, 211, 212, 7, 113, 2, 2, 212, 214, 7, 116, 2, 2, 213, 209,
3, 2, 2, 2, 213, 211, 3, 2, 2, 2, 214, 54, 3, 2, 2, 2, 215, 216, 7, 128,
2, 2, 216, 56, 3, 2, 2, 2, 217, 222, 7, 35, 2, 2, 218, 219, 7, 112, 2,
2, 219, 220, 7, 113, 2, 2, 220, 222, 7, 118, 2, 2, 221, 217, 3, 2, 2, 2,
221, 218, 3, 2, 2, 2, 222, 58, 3, 2, 2, 2, 223, 224, 7, 107, 2, 2, 224,
225, 7, 112, 2, 2, 225, 60, 3, 2, 2, 2, 226, 227, 7, 112, 2, 2, 227, 228,
7, 113, 2, 2, 228, 229, 7, 118, 2, 2, 229, 230, 7, 34, 2, 2, 230, 231,
7, 107, 2, 2, 231, 232, 7, 112, 2, 2, 232, 62, 3, 2, 2, 2, 233, 238, 7,
93, 2, 2, 234, 237, 5, 123, 62, 2, 235, 237, 5, 125, 63, 2, 236, 234, 3,
2, 2, 2, 236, 235, 3, 2, 2, 2, 237, 240, 3, 2, 2, 2, 238, 236, 3, 2, 2,
2, 238, 239, 3, 2, 2, 2, 239, 241, 3, 2, 2, 2, 240, 238, 3, 2, 2, 2, 241,
242, 7, 95, 2, 2, 242, 64, 3, 2, 2, 2, 243, 244, 7, 118, 2, 2, 244, 245,
7, 116, 2, 2, 245, 246, 7, 119, 2, 2, 246, 271, 7, 103, 2, 2, 247, 248,
7, 86, 2, 2, 248, 249, 7, 116, 2, 2, 249, 250, 7, 119, 2, 2, 250, 271,
7, 103, 2, 2, 251, 252, 7, 86, 2, 2, 252, 253, 7, 84, 2, 2, 253, 254, 7,
87, 2, 2, 254, 271, 7, 71, 2, 2, 255, 256, 7, 104, 2, 2, 256, 257, 7, 99,
2, 2, 257, 258, 7, 110, 2, 2, 258, 259, 7, 117, 2, 2, 259, 271, 7, 103,
2, 2, 260, 261, 7, 72, 2, 2, 261, 262, 7, 99, 2, 2, 262, 263, 7, 110, 2,
2, 263, 264, 7, 117, 2, 2, 264, 271, 7, 103, 2, 2, 265, 266, 7, 72, 2,
2, 266, 267, 7, 67, 2, 2, 267, 268, 7, 78, 2, 2, 268, 269, 7, 85, 2, 2,
269, 271, 7, 71, 2, 2, 270, 243, 3, 2, 2, 2, 270, 247, 3, 2, 2, 2, 270,
251, 3, 2, 2, 2, 270, 255, 3, 2, 2, 2, 270, 260, 3, 2, 2, 2, 270, 265,
3, 2, 2, 2, 271, 66, 3, 2, 2, 2, 272, 277, 5, 89, 45, 2, 273, 277, 5, 91,
46, 2, 274, 277, 5, 93, 47, 2, 275, 277, 5, 87, 44, 2, 276, 272, 3, 2,
2, 2, 276, 273, 3, 2, 2, 2, 276, 274, 3, 2, 2, 2, 276, 275, 3, 2, 2, 2,
277, 68, 3, 2, 2, 2, 278, 281, 5, 105, 53, 2, 279, 281, 5, 107, 54, 2,
280, 278, 3, 2, 2, 2, 280, 279, 3, 2, 2, 2, 281, 70, 3, 2, 2, 2, 282, 287,
5, 83, 42, 2, 283, 286, 5, 83, 42, 2, 284, 286, 5, 85, 43, 2, 285, 283,
3, 2, 2, 2, 285, 284, 3, 2, 2, 2, 286, 289, 3, 2, 2, 2, 287, 285, 3, 2,
2, 2, 287, 288, 3, 2, 2, 2, 288, 72, 3, 2, 2, 2, 289, 287, 3, 2, 2, 2,
290, 292, 5, 77, 39, 2, 291, 290, 3, 2, 2, 2, 291, 292, 3, 2, 2, 2, 292,
293, 3, 2, 2, 2, 293, 295, 7, 36, 2, 2, 294, 296, 5, 79, 40, 2, 295, 294,
3, 2, 2, 2, 295, 296, 3, 2, 2, 2, 296, 297, 3, 2, 2, 2, 297, 298, 7, 36,
2, 2, 298, 74, 3, 2, 2, 2, 299, 307, 5, 71, 36, 2, 300, 303, 7, 93, 2,
2, 301, 304, 5, 73, 37, 2, 302, 304, 5, 67, 34, 2, 303, 301, 3, 2, 2, 2,
303, 302, 3, 2, 2, 2, 304, 305, 3, 2, 2, 2, 305, 306, 7, 95, 2, 2, 306,
308, 3, 2, 2, 2, 307, 300, 3, 2, 2, 2, 308, 309, 3, 2, 2, 2, 309, 307,
3, 2, 2, 2, 309, 310, 3, 2, 2, 2, 310, 76, 3, 2, 2, 2, 311, 312, 7, 119,
2, 2, 312, 315, 7, 58, 2, 2, 313, 315, 9, 2, 2, 2, 314, 311, 3, 2, 2, 2,
314, 313, 3, 2, 2, 2, 315, 78, 3, 2, 2, 2, 316, 318, 5, 81, 41, 2, 317,
316, 3, 2, 2, 2, 318, 319, 3, 2, 2, 2, 319, 317, 3, 2, 2, 2, 319, 320,
3, 2, 2, 2, 320, 80, 3, 2, 2, 2, 321, 329, 10, 3, 2, 2, 322, 329, 5, 121,
61, 2, 323, 324, 7, 94, 2, 2, 324, 329, 7, 12, 2, 2, 325, 326, 7, 94, 2,
2, 326, 327, 7, 15, 2, 2, 327, 329, 7, 12, 2, 2, 328, 321, 3, 2, 2, 2,
328, 322, 3, 2, 2, 2, 328, 323, 3, 2, 2, 2, 328, 325, 3, 2, 2, 2, 329,
82, 3, 2, 2, 2, 330, 331, 9, 4, 2, 2, 331, 84, 3, 2, 2, 2, 332, 333, 9,
5, 2, 2, 333, 86, 3, 2, 2, 2, 334, 335, 7, 50, 2, 2, 335, 337, 9, 6, 2,
2, 336, 338, 9, 7, 2, 2, 337, 336, 3, 2, 2, 2, 338, 339, 3, 2, 2, 2, 339,
337, 3, 2, 2, 2, 339, 340, 3, 2, 2, 2, 340, 88, 3, 2, 2, 2, 341, 345, 5,
95, 48, 2, 342, 344, 5, 85, 43, 2, 343, 342, 3, 2, 2, 2, 344, 347, 3, 2,
2, 2, 345, 343, 3, 2, 2, 2, 345, 346, 3, 2, 2, 2, 346, 90, 3, 2, 2, 2,
347, 345, 3, 2, 2, 2, 348, 352, 7, 50, 2, 2, 349, 351, 5, 97, 49, 2, 350,
349, 3, 2, 2, 2, 351, 354, 3, 2, 2, 2, 352, 350, 3, 2, 2, 2, 352, 353,
3, 2, 2, 2, 353, 92, 3, 2, 2, 2, 354, 352, 3, 2, 2, 2, 355, 356, 7, 50,
2, 2, 356, 357, 9, 8, 2, 2, 357, 358, 5, 117, 59, 2, 358, 94, 3, 2, 2,
2, 359, 360, 9, 9, 2, 2, 360, 96, 3, 2, 2, 2, 361, 362, 9, 10, 2, 2, 362,
98, 3, 2, 2, 2, 363, 364, 9, 11, 2, 2, 364, 100, 3, 2, 2, 2, 365, 366,
5, 99, 50, 2, 366, 367, 5, 99, 50, 2, 367, 368, 5, 99, 50, 2, 368, 369,
5, 99, 50, 2, 369, 102, 3, 2, 2, 2, 370, 371, 7, 94, 2, 2, 371, 372, 7,
119, 2, 2, 372, 373, 3, 2, 2, 2, 373, 381, 5, 101, 51, 2, 374, 375, 7,
94, 2, 2, 375, 376, 7, 87, 2, 2, 376, 377, 3, 2, 2, 2, 377, 378, 5, 101,
51, 2, 378, 379, 5, 101, 51, 2, 379, 381, 3, 2, 2, 2, 380, 370, 3, 2, 2,
2, 380, 374, 3, 2, 2, 2, 381, 104, 3, 2, 2, 2, 382, 384, 5, 109, 55, 2,
383, 385, 5, 111, 56, 2, 384, 383, 3, 2, 2, 2, 384, 385, 3, 2, 2, 2, 385,
390, 3, 2, 2, 2, 386, 387, 5, 113, 57, 2, 387, 388, 5, 111, 56, 2, 388,
390, 3, 2, 2, 2, 389, 382, 3, 2, 2, 2, 389, 386, 3, 2, 2, 2, 390, 106,
3, 2, 2, 2, 391, 392, 7, 50, 2, 2, 392, 395, 9, 8, 2, 2, 393, 396, 5, 115,
58, 2, 394, 396, 5, 117, 59, 2, 395, 393, 3, 2, 2, 2, 395, 394, 3, 2, 2,
2, 396, 397, 3, 2, 2, 2, 397, 398, 5, 119, 60, 2, 398, 108, 3, 2, 2, 2,
399, 401, 5, 113, 57, 2, 400, 399, 3, 2, 2, 2, 400, 401, 3, 2, 2, 2, 401,
402, 3, 2, 2, 2, 402, 403, 7, 48, 2, 2, 403, 408, 5, 113, 57, 2, 404, 405,
5, 113, 57, 2, 405, 406, 7, 48, 2, 2, 406, 408, 3, 2, 2, 2, 407, 400, 3,
2, 2, 2, 407, 404, 3, 2, 2, 2, 408, 110, 3, 2, 2, 2, 409, 411, 9, 12, 2,
2, 410, 412, 9, 13, 2, 2, 411, 410, 3, 2, 2, 2, 411, 412, 3, 2, 2, 2, 412,
413, 3, 2, 2, 2, 413, 414, 5, 113, 57, 2, 414, 112, 3, 2, 2, 2, 415, 417,
5, 85, 43, 2, 416, 415, 3, 2, 2, 2, 417, 418, 3, 2, 2, 2, 418, 416, 3,
2, 2, 2, 418, 419, 3, 2, 2, 2, 419, 114, 3, 2, 2, 2, 420, 422, 5, 117,
59, 2, 421, 420, 3, 2, 2, 2, 421, 422, 3, 2, 2, 2, 422, 423, 3, 2, 2, 2,
423, 424, 7, 48, 2, 2, 424, 429, 5, 117, 59, 2, 425, 426, 5, 117, 59, 2,
426, 427, 7, 48, 2, 2, 427, 429, 3, 2, 2, 2, 428, 421, 3, 2, 2, 2, 428,
425, 3, 2, 2, 2, 429, 116, 3, 2, 2, 2, 430, 432, 5, 99, 50, 2, 431, 430,
3, 2, 2, 2, 432, 433, 3, 2, 2, 2, 433, 431, 3, 2, 2, 2, 433, 434, 3, 2,
2, 2, 434, 118, 3, 2, 2, 2, 435, 437, 9, 14, 2, 2, 436, 438, 9, 13, 2,
2, 437, 436, 3, 2, 2, 2, 437, 438, 3, 2, 2, 2, 438, 439, 3, 2, 2, 2, 439,
440, 5, 113, 57, 2, 440, 120, 3, 2, 2, 2, 441, 442, 7, 94, 2, 2, 442, 457,
9, 15, 2, 2, 443, 444, 7, 94, 2, 2, 444, 446, 5, 97, 49, 2, 445, 447, 5,
97, 49, 2, 446, 445, 3, 2, 2, 2, 446, 447, 3, 2, 2, 2, 447, 449, 3, 2,
2, 2, 448, 450, 5, 97, 49, 2, 449, 448, 3, 2, 2, 2, 449, 450, 3, 2, 2,
2, 450, 457, 3, 2, 2, 2, 451, 452, 7, 94, 2, 2, 452, 453, 7, 122, 2, 2,
453, 454, 3, 2, 2, 2, 454, 457, 5, 117, 59, 2, 455, 457, 5, 103, 52, 2,
456, 441, 3, 2, 2, 2, 456, 443, 3, 2, 2, 2, 456, 451, 3, 2, 2, 2, 456,
455, 3, 2, 2, 2, 457, 122, 3, 2, 2, 2, 458, 460, 9, 16, 2, 2, 459, 458,
3, 2, 2, 2, 460, 461, 3, 2, 2, 2, 461, 459, 3, 2, 2, 2, 461, 462, 3, 2,
2, 2, 462, 463, 3, 2, 2, 2, 463, 464, 8, 62, 2, 2, 464, 124, 3, 2, 2, 2,
465, 467, 7, 15, 2, 2, 466, 468, 7, 12, 2, 2, 467, 466, 3, 2, 2, 2, 467,
468, 3, 2, 2, 2, 468, 471, 3, 2, 2, 2, 469, 471, 7, 12, 2, 2, 470, 465,
3, 2, 2, 2, 470, 469, 3, 2, 2, 2, 471, 472, 3, 2, 2, 2, 472, 473, 8, 63,
2, 2, 473, 126, 3, 2, 2, 2, 43, 2, 161, 175, 207, 213, 221, 236, 238, 270,
276, 280, 285, 287, 291, 295, 303, 309, 314, 319, 328, 339, 345, 352, 380,
384, 389, 395, 400, 407, 411, 418, 421, 428, 433, 437, 446, 449, 456, 461,
467, 470, 3, 8, 2, 2,
}
var lexerChannelNames = []string{
@ -231,25 +245,26 @@ var lexerModeNames = []string{
var lexerLiteralNames = []string{
"", "'('", "')'", "'['", "','", "']'", "'<'", "'<='", "'>'", "'>='", "'=='",
"'!='", "", "'+'", "'-'", "'*'", "'/'", "'%'", "'**'", "'<<'", "'>>'",
"'!='", "", "", "'+'", "'-'", "'*'", "'/'", "'%'", "'**'", "'<<'", "'>>'",
"'&'", "'|'", "'^'", "", "", "'~'", "", "'in'", "'not in'",
}
var lexerSymbolicNames = []string{
"", "", "", "", "", "", "LT", "LE", "GT", "GE", "EQ", "NE", "LIKE", "ADD",
"SUB", "MUL", "DIV", "MOD", "POW", "SHL", "SHR", "BAND", "BOR", "BXOR",
"AND", "OR", "BNOT", "NOT", "IN", "NIN", "EmptyTerm", "BooleanConstant",
"IntegerConstant", "FloatingConstant", "Identifier", "StringLiteral", "Whitespace",
"Newline",
"", "", "", "", "", "", "LT", "LE", "GT", "GE", "EQ", "NE", "LIKE", "EXISTS",
"ADD", "SUB", "MUL", "DIV", "MOD", "POW", "SHL", "SHR", "BAND", "BOR",
"BXOR", "AND", "OR", "BNOT", "NOT", "IN", "NIN", "EmptyTerm", "BooleanConstant",
"IntegerConstant", "FloatingConstant", "Identifier", "StringLiteral", "JSONIdentifier",
"Whitespace", "Newline",
}
var lexerRuleNames = []string{
"T__0", "T__1", "T__2", "T__3", "T__4", "LT", "LE", "GT", "GE", "EQ", "NE",
"LIKE", "ADD", "SUB", "MUL", "DIV", "MOD", "POW", "SHL", "SHR", "BAND",
"BOR", "BXOR", "AND", "OR", "BNOT", "NOT", "IN", "NIN", "EmptyTerm", "BooleanConstant",
"IntegerConstant", "FloatingConstant", "Identifier", "StringLiteral", "EncodingPrefix",
"SCharSequence", "SChar", "Nondigit", "Digit", "BinaryConstant", "DecimalConstant",
"OctalConstant", "HexadecimalConstant", "NonzeroDigit", "OctalDigit", "HexadecimalDigit",
"LIKE", "EXISTS", "ADD", "SUB", "MUL", "DIV", "MOD", "POW", "SHL", "SHR",
"BAND", "BOR", "BXOR", "AND", "OR", "BNOT", "NOT", "IN", "NIN", "EmptyTerm",
"BooleanConstant", "IntegerConstant", "FloatingConstant", "Identifier",
"StringLiteral", "JSONIdentifier", "EncodingPrefix", "SCharSequence", "SChar",
"Nondigit", "Digit", "BinaryConstant", "DecimalConstant", "OctalConstant",
"HexadecimalConstant", "NonzeroDigit", "OctalDigit", "HexadecimalDigit",
"HexQuad", "UniversalCharacterName", "DecimalFloatingConstant", "HexadecimalFloatingConstant",
"FractionalConstant", "ExponentPart", "DigitSequence", "HexadecimalFractionalConstant",
"HexadecimalDigitSequence", "BinaryExponentPart", "EscapeSequence", "Whitespace",
@ -305,29 +320,31 @@ const (
PlanLexerEQ = 10
PlanLexerNE = 11
PlanLexerLIKE = 12
PlanLexerADD = 13
PlanLexerSUB = 14
PlanLexerMUL = 15
PlanLexerDIV = 16
PlanLexerMOD = 17
PlanLexerPOW = 18
PlanLexerSHL = 19
PlanLexerSHR = 20
PlanLexerBAND = 21
PlanLexerBOR = 22
PlanLexerBXOR = 23
PlanLexerAND = 24
PlanLexerOR = 25
PlanLexerBNOT = 26
PlanLexerNOT = 27
PlanLexerIN = 28
PlanLexerNIN = 29
PlanLexerEmptyTerm = 30
PlanLexerBooleanConstant = 31
PlanLexerIntegerConstant = 32
PlanLexerFloatingConstant = 33
PlanLexerIdentifier = 34
PlanLexerStringLiteral = 35
PlanLexerWhitespace = 36
PlanLexerNewline = 37
PlanLexerEXISTS = 13
PlanLexerADD = 14
PlanLexerSUB = 15
PlanLexerMUL = 16
PlanLexerDIV = 17
PlanLexerMOD = 18
PlanLexerPOW = 19
PlanLexerSHL = 20
PlanLexerSHR = 21
PlanLexerBAND = 22
PlanLexerBOR = 23
PlanLexerBXOR = 24
PlanLexerAND = 25
PlanLexerOR = 26
PlanLexerBNOT = 27
PlanLexerNOT = 28
PlanLexerIN = 29
PlanLexerNIN = 30
PlanLexerEmptyTerm = 31
PlanLexerBooleanConstant = 32
PlanLexerIntegerConstant = 33
PlanLexerFloatingConstant = 34
PlanLexerIdentifier = 35
PlanLexerStringLiteral = 36
PlanLexerJSONIdentifier = 37
PlanLexerWhitespace = 38
PlanLexerNewline = 39
)

File diff suppressed because it is too large Load Diff

View File

@ -7,6 +7,39 @@ import "github.com/antlr/antlr4/runtime/Go/antlr"
type PlanVisitor interface {
antlr.ParseTreeVisitor
// Visit a parse tree produced by PlanParser#JSONIdentifier.
VisitJSONIdentifier(ctx *JSONIdentifierContext) interface{}
// Visit a parse tree produced by PlanParser#Parens.
VisitParens(ctx *ParensContext) interface{}
// Visit a parse tree produced by PlanParser#String.
VisitString(ctx *StringContext) interface{}
// Visit a parse tree produced by PlanParser#Floating.
VisitFloating(ctx *FloatingContext) interface{}
// Visit a parse tree produced by PlanParser#LogicalOr.
VisitLogicalOr(ctx *LogicalOrContext) interface{}
// Visit a parse tree produced by PlanParser#MulDivMod.
VisitMulDivMod(ctx *MulDivModContext) interface{}
// Visit a parse tree produced by PlanParser#Identifier.
VisitIdentifier(ctx *IdentifierContext) interface{}
// Visit a parse tree produced by PlanParser#Like.
VisitLike(ctx *LikeContext) interface{}
// Visit a parse tree produced by PlanParser#LogicalAnd.
VisitLogicalAnd(ctx *LogicalAndContext) interface{}
// Visit a parse tree produced by PlanParser#Equality.
VisitEquality(ctx *EqualityContext) interface{}
// Visit a parse tree produced by PlanParser#Boolean.
VisitBoolean(ctx *BooleanContext) interface{}
// Visit a parse tree produced by PlanParser#Shift.
VisitShift(ctx *ShiftContext) interface{}
@ -19,60 +52,33 @@ type PlanVisitor interface {
// Visit a parse tree produced by PlanParser#AddSub.
VisitAddSub(ctx *AddSubContext) interface{}
// Visit a parse tree produced by PlanParser#Parens.
VisitParens(ctx *ParensContext) interface{}
// Visit a parse tree produced by PlanParser#Relational.
VisitRelational(ctx *RelationalContext) interface{}
// Visit a parse tree produced by PlanParser#String.
VisitString(ctx *StringContext) interface{}
// Visit a parse tree produced by PlanParser#Term.
VisitTerm(ctx *TermContext) interface{}
// Visit a parse tree produced by PlanParser#Floating.
VisitFloating(ctx *FloatingContext) interface{}
// Visit a parse tree produced by PlanParser#Range.
VisitRange(ctx *RangeContext) interface{}
// Visit a parse tree produced by PlanParser#Unary.
VisitUnary(ctx *UnaryContext) interface{}
// Visit a parse tree produced by PlanParser#LogicalOr.
VisitLogicalOr(ctx *LogicalOrContext) interface{}
// Visit a parse tree produced by PlanParser#Integer.
VisitInteger(ctx *IntegerContext) interface{}
// Visit a parse tree produced by PlanParser#MulDivMod.
VisitMulDivMod(ctx *MulDivModContext) interface{}
// Visit a parse tree produced by PlanParser#Identifier.
VisitIdentifier(ctx *IdentifierContext) interface{}
// Visit a parse tree produced by PlanParser#BitXor.
VisitBitXor(ctx *BitXorContext) interface{}
// Visit a parse tree produced by PlanParser#Like.
VisitLike(ctx *LikeContext) interface{}
// Visit a parse tree produced by PlanParser#Exists.
VisitExists(ctx *ExistsContext) interface{}
// Visit a parse tree produced by PlanParser#BitAnd.
VisitBitAnd(ctx *BitAndContext) interface{}
// Visit a parse tree produced by PlanParser#LogicalAnd.
VisitLogicalAnd(ctx *LogicalAndContext) interface{}
// Visit a parse tree produced by PlanParser#EmptyTerm.
VisitEmptyTerm(ctx *EmptyTermContext) interface{}
// Visit a parse tree produced by PlanParser#Equality.
VisitEquality(ctx *EqualityContext) interface{}
// Visit a parse tree produced by PlanParser#Boolean.
VisitBoolean(ctx *BooleanContext) interface{}
// Visit a parse tree produced by PlanParser#Power.
VisitPower(ctx *PowerContext) interface{}
}

View File

@ -3,6 +3,9 @@ package planparserv2
import (
"fmt"
"strconv"
"strings"
"github.com/antlr/antlr4/runtime/Go/antlr"
"github.com/milvus-io/milvus-proto/go-api/schemapb"
parser "github.com/milvus-io/milvus/internal/parser/planparserv2/generated"
@ -25,10 +28,17 @@ func (v *ParserVisitor) VisitParens(ctx *parser.ParensContext) interface{} {
}
func (v *ParserVisitor) translateIdentifier(identifier string) (*ExprWithType, error) {
field, err := v.schema.GetFieldFromName(identifier)
field, err := v.schema.GetFieldFromNameDefaultJSON(identifier)
if err != nil {
return nil, err
}
var nestedPath []string
if identifier != field.Name {
nestedPath = append(nestedPath, identifier)
}
if typeutil.IsJSONType(field.DataType) && len(nestedPath) == 0 {
return nil, fmt.Errorf("can not comparisons jsonField directly")
}
return &ExprWithType{
expr: &planpb.Expr{
Expr: &planpb.Expr_ColumnExpr{
@ -38,6 +48,7 @@ func (v *ParserVisitor) translateIdentifier(identifier string) (*ExprWithType, e
DataType: field.DataType,
IsPrimaryKey: field.IsPrimaryKey,
IsAutoID: field.AutoID,
NestedPath: nestedPath,
},
},
},
@ -175,8 +186,9 @@ func (v *ParserVisitor) VisitAddSub(ctx *parser.AddSubContext) interface{} {
return fmt.Errorf("invalid arithmetic expression, left: %s, op: %s, right: %s", ctx.Expr(0).GetText(), ctx.GetOp(), ctx.Expr(1).GetText())
}
if !typeutil.IsArithmetic(leftExpr.dataType) || !typeutil.IsArithmetic(rightExpr.dataType) {
return fmt.Errorf("'%s' can only be used between integer or floating expressions", arithNameMap[ctx.GetOp().GetTokenType()])
if (!typeutil.IsArithmetic(leftExpr.dataType) && !typeutil.IsJSONType(leftExpr.dataType)) ||
(!typeutil.IsArithmetic(rightExpr.dataType) && !typeutil.IsJSONType(rightExpr.dataType)) {
return fmt.Errorf("'%s' can only be used between integer or floating or json field expressions", arithNameMap[ctx.GetOp().GetTokenType()])
}
expr := &planpb.Expr{
@ -252,13 +264,15 @@ func (v *ParserVisitor) VisitMulDivMod(ctx *parser.MulDivModContext) interface{}
return fmt.Errorf("invalid arithmetic expression, left: %s, op: %s, right: %s", ctx.Expr(0).GetText(), ctx.GetOp(), ctx.Expr(1).GetText())
}
if !typeutil.IsArithmetic(leftExpr.dataType) || !typeutil.IsArithmetic(rightExpr.dataType) {
if (!typeutil.IsArithmetic(leftExpr.dataType) && !typeutil.IsJSONType(leftExpr.dataType)) ||
(!typeutil.IsArithmetic(rightExpr.dataType) && !typeutil.IsJSONType(rightExpr.dataType)) {
return fmt.Errorf("'%s' can only be used between integer or floating expressions", arithNameMap[ctx.GetOp().GetTokenType()])
}
switch ctx.GetOp().GetTokenType() {
case parser.PlanParserMOD:
if !typeutil.IsIntegerType(leftExpr.dataType) || !typeutil.IsIntegerType(rightExpr.dataType) {
if (!typeutil.IsIntegerType(leftExpr.dataType) && !typeutil.IsJSONType(leftExpr.dataType)) ||
(!typeutil.IsIntegerType(rightExpr.dataType) && !typeutil.IsJSONType(rightExpr.dataType)) {
return fmt.Errorf("modulo can only apply on integer types")
}
default:
@ -344,6 +358,7 @@ func (v *ParserVisitor) VisitRelational(ctx *parser.RelationalContext) interface
}
leftValue, rightValue := getGenericValue(left), getGenericValue(right)
if leftValue != nil && rightValue != nil {
switch ctx.GetOp().GetTokenType() {
case parser.PlanParserLT:
@ -395,8 +410,8 @@ func (v *ParserVisitor) VisitLike(ctx *parser.LikeContext) interface{} {
return fmt.Errorf("the left operand of like is invalid")
}
if !typeutil.IsStringType(leftExpr.dataType) {
return fmt.Errorf("like operation on non-string field is unsupported")
if !typeutil.IsStringType(leftExpr.dataType) && !typeutil.IsJSONType(leftExpr.dataType) {
return fmt.Errorf("like operation on non-string or no-json field is unsupported")
}
column := toColumnInfo(leftExpr)
@ -531,16 +546,22 @@ func (v *ParserVisitor) VisitEmptyTerm(ctx *parser.EmptyTermContext) interface{}
}
}
// VisitRange translates expr to range plan.
func (v *ParserVisitor) VisitRange(ctx *parser.RangeContext) interface{} {
identifier := ctx.Identifier().GetText()
childExpr, err := v.translateIdentifier(identifier)
if err != nil {
return err
func (v *ParserVisitor) getChildColumnInfo(identifier, child antlr.TerminalNode) (*planpb.ColumnInfo, error) {
if identifier != nil {
childExpr, err := v.translateIdentifier(identifier.GetText())
if err != nil {
return nil, err
}
return toColumnInfo(childExpr), nil
}
columnInfo := toColumnInfo(childExpr)
if columnInfo == nil {
return v.getColumnInfoFromJSONIdentifier(child.GetText())
}
// VisitRange translates expr to range plan.
func (v *ParserVisitor) VisitRange(ctx *parser.RangeContext) interface{} {
columnInfo, err := v.getChildColumnInfo(ctx.Identifier(), ctx.JSONIdentifier())
if columnInfo == nil || err != nil {
return fmt.Errorf("range operations are only supported on single fields now, got: %s", ctx.Expr(1).GetText())
}
@ -562,7 +583,7 @@ func (v *ParserVisitor) VisitRange(ctx *parser.RangeContext) interface{} {
return fmt.Errorf("upperbound cannot be a non-const expression: %s", ctx.Expr(1).GetText())
}
switch childExpr.dataType {
switch columnInfo.GetDataType() {
case schemapb.DataType_String, schemapb.DataType_VarChar:
if !IsString(lowerValue) || !IsString(upperValue) {
return fmt.Errorf("invalid range operations")
@ -617,13 +638,10 @@ func (v *ParserVisitor) VisitRange(ctx *parser.RangeContext) interface{} {
// VisitReverseRange parses the expression like "1 > a > 0".
func (v *ParserVisitor) VisitReverseRange(ctx *parser.ReverseRangeContext) interface{} {
identifier := ctx.Identifier().GetText()
childExpr, err := v.translateIdentifier(identifier)
columnInfo, err := v.getChildColumnInfo(ctx.Identifier(), ctx.JSONIdentifier())
if err != nil {
return err
}
columnInfo := toColumnInfo(childExpr)
if columnInfo == nil {
return fmt.Errorf("range operations are only supported on single fields now, got: %s", ctx.Expr(1).GetText())
}
@ -646,7 +664,7 @@ func (v *ParserVisitor) VisitReverseRange(ctx *parser.ReverseRangeContext) inter
return fmt.Errorf("upperbound cannot be a non-const expression: %s", ctx.Expr(1).GetText())
}
switch childExpr.dataType {
switch columnInfo.GetDataType() {
case schemapb.DataType_String, schemapb.DataType_VarChar:
if !IsString(lowerValue) || !IsString(upperValue) {
return fmt.Errorf("invalid range operations")
@ -882,3 +900,112 @@ func (v *ParserVisitor) VisitShift(ctx *parser.ShiftContext) interface{} {
func (v *ParserVisitor) VisitBitOr(ctx *parser.BitOrContext) interface{} {
return fmt.Errorf("BitOr is not supported: %s", ctx.GetText())
}
// getColumnInfoFromJSONIdentifier parse JSON field name and JSON nested path.
// input: user["name"]["first"],
// output: if user is JSON field name, and fieldID is 102
/*
&planpb.ColumnInfo{
FieldId: 102,
DataType: JSON,
NestedPath: []string{"name", "first"},
}, nil
*/
// if user is not JSON field name, and $SYS_META fieldID is 102:
/*
&planpb.ColumnInfo{
FieldId: 102,
DataType: JSON,
NestedPath: []string{"user", "name", "first"},
}, nil
*/
// input: user,
// output: if user is JSON field name, return error.
// if user is not JSON field name, and $SYS_META fieldID is 102:
/*
&planpb.ColumnInfo{
FieldId: 102,
DataType: JSON,
NestedPath: []string{"user"},
}, nil
*/
// More tests refer to plan_parser_v2_test.go::Test_JSONExpr
func (v *ParserVisitor) getColumnInfoFromJSONIdentifier(identifier string) (*planpb.ColumnInfo, error) {
ss := strings.Split(identifier, "[")
fieldName := ss[0]
length := len(ss)
nestedPath := make([]string, 0, length)
jsonField, err := v.schema.GetFieldFromNameDefaultJSON(fieldName)
if err != nil {
return nil, err
}
if fieldName != jsonField.Name {
nestedPath = append(nestedPath, fieldName)
}
for i := 1; i < length; i++ {
path := strings.Trim(strings.Trim(ss[i], "[]"), "\"")
nestedPath = append(nestedPath, path)
}
if typeutil.IsJSONType(jsonField.DataType) && len(nestedPath) == 0 {
return nil, fmt.Errorf("can not comparisons jsonField directly")
}
return &planpb.ColumnInfo{
FieldId: jsonField.FieldID,
DataType: jsonField.DataType,
NestedPath: nestedPath,
}, nil
}
func (v *ParserVisitor) VisitJSONIdentifier(ctx *parser.JSONIdentifierContext) interface{} {
jsonField, err := v.getColumnInfoFromJSONIdentifier(ctx.JSONIdentifier().GetText())
if err != nil {
return err
}
return &ExprWithType{
expr: &planpb.Expr{
Expr: &planpb.Expr_ColumnExpr{
ColumnExpr: &planpb.ColumnExpr{
Info: &planpb.ColumnInfo{
FieldId: jsonField.GetFieldId(),
DataType: jsonField.GetDataType(),
NestedPath: jsonField.GetNestedPath(),
},
},
},
},
dataType: jsonField.GetDataType(),
}
}
func (v *ParserVisitor) VisitExists(ctx *parser.ExistsContext) interface{} {
child := ctx.Expr().Accept(v)
if err := getError(child); err != nil {
return err
}
columnInfo := toColumnInfo(child.(*ExprWithType))
if columnInfo == nil {
return fmt.Errorf(
"exists operations are only supported on single fields now, got: %s", ctx.Expr().GetText())
}
if columnInfo.GetDataType() != schemapb.DataType_JSON {
return fmt.Errorf(
"exists oerations are only supportted on json field, got:%s", columnInfo.GetDataType())
}
return &ExprWithType{
expr: &planpb.Expr{
Expr: &planpb.Expr_ExistsExpr{
ExistsExpr: &planpb.ExistsExpr{
Info: &planpb.ColumnInfo{
FieldId: columnInfo.GetFieldId(),
DataType: columnInfo.GetDataType(),
NestedPath: columnInfo.GetNestedPath(),
},
},
},
},
dataType: schemapb.DataType_Bool,
}
}

View File

@ -3,11 +3,10 @@ package planparserv2
import (
"fmt"
"github.com/antlr/antlr4/runtime/Go/antlr"
"github.com/milvus-io/milvus-proto/go-api/schemapb"
"github.com/milvus-io/milvus/internal/proto/planpb"
"github.com/milvus-io/milvus/pkg/util/typeutil"
"github.com/antlr/antlr4/runtime/Go/antlr"
)
func handleExpr(schema *typeutil.SchemaHelper, exprStr string) interface{} {
@ -56,7 +55,6 @@ func ParseExpr(schema *typeutil.SchemaHelper, exprStr string) (*planpb.Expr, err
if predicate == nil {
return nil, fmt.Errorf("cannot parse expression: %s", exprStr)
}
if !typeutil.IsBoolType(predicate.dataType) {
return nil, fmt.Errorf("predicate is not a boolean expression: %s, data type: %s", exprStr, predicate.dataType)
}

View File

@ -4,6 +4,9 @@ import (
"sync"
"testing"
"github.com/milvus-io/milvus/pkg/log"
"go.uber.org/zap"
"github.com/milvus-io/milvus/internal/proto/planpb"
"github.com/stretchr/testify/assert"
@ -64,8 +67,15 @@ func TestExpr_Term(t *testing.T) {
`StringField in ["str13", "str14"]`,
`VarCharField in ["str15", "str16"]`,
`FloatField in [1373, 115]`,
`Int64Field in [17]`,
`Int64Field in []`,
`Int64Field not in []`,
`JSONField["A"] in [1, 10]`,
`JSONField["A"] in []`,
`A in [1, 10]`,
`A in []`,
`A in ["abc", "def"]`,
`A in ["1", "2", "abc", "def"]`,
}
for _, exprStr := range exprStrs {
assertValidExpr(t, helper, exprStr)
@ -84,6 +94,7 @@ func TestExpr_Compare(t *testing.T) {
`Int64Field >= FloatField`,
`FloatField == DoubleField`,
`StringField != VarCharField`,
`JSONField["A"] > Int16Field`,
}
for _, exprStr := range exprStrs {
assertValidExpr(t, helper, exprStr)
@ -105,6 +116,7 @@ func TestExpr_UnaryRange(t *testing.T) {
`DoubleField != 5.0`,
`StringField > "str6"`,
`VarCharField <= "str7"`,
`JSONField["A"] > 10`,
}
for _, exprStr := range exprStrs {
assertValidExpr(t, helper, exprStr)
@ -119,6 +131,7 @@ func TestExpr_Like(t *testing.T) {
exprStrs := []string{
`VarCharField like "prefix%"`,
`VarCharField like "equal"`,
`JSONField["A"] like "name*"`,
}
for _, exprStr := range exprStrs {
assertValidExpr(t, helper, exprStr)
@ -127,6 +140,7 @@ func TestExpr_Like(t *testing.T) {
// TODO: enable these after regex-match is supported.
unsupported := []string{
`VarCharField like "not_%_supported"`,
`JSONField["A"] like "not_%_supported"`,
}
for _, exprStr := range unsupported {
assertInvalidExpr(t, helper, exprStr)
@ -148,6 +162,7 @@ func TestExpr_BinaryRange(t *testing.T) {
`"str13" < StringField < "str14"`,
`"str15" < VarCharField < "str16"`,
`17 < DoubleField < 18`,
`10 < A < 25`,
`2 > Int8Field > 1`,
`4 >= Int16Field >= 3`,
@ -158,6 +173,7 @@ func TestExpr_BinaryRange(t *testing.T) {
`"str14" > StringField > "str13"`,
`"str16" > VarCharField > "str15"`,
`18 > DoubleField > 17`,
`100 > B > 14`,
}
for _, exprStr := range exprStrs {
assertValidExpr(t, helper, exprStr)
@ -172,6 +188,7 @@ func TestExpr_BinaryArith(t *testing.T) {
exprStrs := []string{
`Int64Field % 10 == 9`,
`Int64Field % 10 != 9`,
`A % 10 != 2`,
}
for _, exprStr := range exprStrs {
assertValidExpr(t, helper, exprStr)
@ -185,6 +202,7 @@ func TestExpr_BinaryArith(t *testing.T) {
`Int64Field / 7 >= 8`,
`FloatField + 11 < 12`,
`DoubleField - 13 < 14`,
`A - 15 < 16`,
}
for _, exprStr := range unsupported {
assertInvalidExpr(t, helper, exprStr)
@ -226,6 +244,7 @@ func TestExpr_Identifier(t *testing.T) {
`DoubleField`,
`StringField`,
`VarCharField`,
`JSONField["A"]`,
}
for _, exprStr := range exprStrs {
expr := handleExpr(helper, exprStr)
@ -319,6 +338,7 @@ func TestExpr_Combinations(t *testing.T) {
`(Int64Field / 7 != 8) or (Int64Field % 10 == 9)`,
`Int64Field > 0 && VarCharField > "0"`,
`Int64Field < 0 && VarCharField < "0"`,
`A > 50 or B < 40`,
}
for _, exprStr := range exprStrs {
assertValidExpr(t, helper, exprStr)
@ -333,13 +353,14 @@ func TestCreateRetrievePlan(t *testing.T) {
func TestCreateSearchPlan(t *testing.T) {
schema := newTestSchema()
_, err := CreateSearchPlan(schema, "Int64Field > 0", "FloatVectorField", &planpb.QueryInfo{
plan, err := CreateSearchPlan(schema, `JSONField["A"] != 10`, "FloatVectorField", &planpb.QueryInfo{
Topk: 0,
MetricType: "",
SearchParams: "",
RoundDecimal: 0,
})
assert.NoError(t, err)
log.Info("plan", zap.Any("plan", plan))
}
func TestExpr_Invalid(t *testing.T) {
@ -380,15 +401,15 @@ func TestExpr_Invalid(t *testing.T) {
`StringField * 2`,
`2 / StringField`,
// ----------------------- ==/!= -------------------------
`not_in_schema != 1`,
`1 == not_in_schema`,
//`not_in_schema != 1`, // maybe in json
//`1 == not_in_schema`, // maybe in json
`true == "str"`,
`"str" != false`,
`VarCharField != FloatField`,
`FloatField == VarCharField`,
// ---------------------- relational --------------------
`not_in_schema < 1`,
`1 <= not_in_schema`,
//`not_in_schema < 1`, // maybe in json
//`1 <= not_in_schema`, // maybe in json
`true <= "str"`,
`"str" >= false`,
`VarCharField < FloatField`,
@ -396,9 +417,9 @@ func TestExpr_Invalid(t *testing.T) {
// ------------------------ like ------------------------
`(VarCharField % 2) like "prefix%"`,
`FloatField like "prefix%"`,
`value like "prefix%"`,
//`value like "prefix%"`, // maybe in json
// ------------------------ term ------------------------
`not_in_schema in [1, 2, 3]`,
//`not_in_schema in [1, 2, 3]`, // maybe in json
`1 in [1, 2, 3]`,
`(Int8Field + 8) in [1, 2, 3]`,
`Int8Field in [(true + 1)]`,
@ -408,7 +429,7 @@ func TestExpr_Invalid(t *testing.T) {
`Int32Field in [4.0]`,
`FloatField in [5, 6.0, true]`,
// ----------------------- range -------------------------
`1 < not_in_schema < 2`,
//`1 < not_in_schema < 2`, // maybe in json
`1 < 3 < 2`,
`1 < (Int8Field + Int16Field) < 2`,
`(invalid_lower) < Int32Field < 2`,
@ -499,7 +520,7 @@ func Test_handleExpr(t *testing.T) {
schemaHelper, err := typeutil.CreateSchemaHelper(schema)
assert.NoError(t, err)
ret1 := handleExpr(schemaHelper, "this is not a normal expression")
ret1 := handleExpr(schemaHelper, "1 < Int32Field < (Int16Field)")
err1, ok := ret1.(error)
assert.True(t, ok)
assert.Error(t, err1)
@ -511,7 +532,7 @@ func Test_handleExpr_17126(t *testing.T) {
schemaHelper, err := typeutil.CreateSchemaHelper(schema)
assert.NoError(t, err)
normal := "Int64Field > 0"
abnormal := "this is not a normal expression"
abnormal := "1 < Int32Field < (Int16Field)"
n := 4 // default parallel in regression.
m := 16
@ -535,3 +556,461 @@ func Test_handleExpr_17126(t *testing.T) {
}
wg.Wait()
}
func Test_JSONExpr(t *testing.T) {
schema := newTestSchema()
expr := ""
// search
expr = `JSONField["A"] > 90`
_, err := CreateSearchPlan(schema, expr, "FloatVectorField", &planpb.QueryInfo{
Topk: 0,
MetricType: "",
SearchParams: "",
RoundDecimal: 0,
})
assert.NoError(t, err)
expr = `A < 10`
_, err = CreateSearchPlan(schema, expr, "FloatVectorField", &planpb.QueryInfo{
Topk: 0,
MetricType: "",
SearchParams: "",
RoundDecimal: 0,
})
assert.NoError(t, err)
expr = `JSONField["A"] <= 5`
_, err = CreateSearchPlan(schema, expr, "FloatVectorField", &planpb.QueryInfo{
Topk: 0,
MetricType: "",
SearchParams: "",
RoundDecimal: 0,
})
assert.NoError(t, err)
expr = `JSONField["A"] >= 95`
_, err = CreateSearchPlan(schema, expr, "FloatVectorField", &planpb.QueryInfo{
Topk: 0,
MetricType: "",
SearchParams: "",
RoundDecimal: 0,
})
assert.NoError(t, err)
expr = `JSONField["A"] == 5`
_, err = CreateSearchPlan(schema, expr, "FloatVectorField", &planpb.QueryInfo{
Topk: 0,
MetricType: "",
SearchParams: "",
RoundDecimal: 0,
})
assert.NoError(t, err)
expr = `JSONField["A"] != 95`
_, err = CreateSearchPlan(schema, expr, "FloatVectorField", &planpb.QueryInfo{
Topk: 0,
MetricType: "",
SearchParams: "",
RoundDecimal: 0,
})
assert.NoError(t, err)
expr = `JSONField["A"] > 90 && JSONField["B"] < 5`
_, err = CreateSearchPlan(schema, expr, "FloatVectorField", &planpb.QueryInfo{
Topk: 0,
MetricType: "",
SearchParams: "",
RoundDecimal: 0,
})
assert.NoError(t, err)
expr = `JSONField["A"] > 95 || JSONField["B"] < 5`
_, err = CreateSearchPlan(schema, expr, "FloatVectorField", &planpb.QueryInfo{
Topk: 0,
MetricType: "",
SearchParams: "",
RoundDecimal: 0,
})
assert.NoError(t, err)
expr = `A > 95 || JSONField["B"] < 5`
_, err = CreateSearchPlan(schema, expr, "FloatVectorField", &planpb.QueryInfo{
Topk: 0,
MetricType: "",
SearchParams: "",
RoundDecimal: 0,
})
assert.NoError(t, err)
expr = `not (JSONField["A"] == 95)`
_, err = CreateSearchPlan(schema, expr, "FloatVectorField", &planpb.QueryInfo{
Topk: 0,
MetricType: "",
SearchParams: "",
RoundDecimal: 0,
})
assert.NoError(t, err)
expr = `JSONField["A"] in [90, 91, 95, 97]`
_, err = CreateSearchPlan(schema, expr, "FloatVectorField", &planpb.QueryInfo{
Topk: 0,
MetricType: "",
SearchParams: "",
RoundDecimal: 0,
})
assert.NoError(t, err)
expr = `JSONField["A"] not in [90, 91, 95, 97]`
_, err = CreateSearchPlan(schema, expr, "FloatVectorField", &planpb.QueryInfo{
Topk: 0,
MetricType: "",
SearchParams: "",
RoundDecimal: 0,
})
assert.NoError(t, err)
expr = `JSONField["C"]["0"] in [90, 91, 95, 97]`
_, err = CreateSearchPlan(schema, expr, "FloatVectorField", &planpb.QueryInfo{
Topk: 0,
MetricType: "",
SearchParams: "",
RoundDecimal: 0,
})
assert.NoError(t, err)
expr = `JSONField["C"]["0"] not in [90, 91, 95, 97]`
_, err = CreateSearchPlan(schema, expr, "FloatVectorField", &planpb.QueryInfo{
Topk: 0,
MetricType: "",
SearchParams: "",
RoundDecimal: 0,
})
assert.NoError(t, err)
expr = `C["0"] > 90`
_, err = CreateSearchPlan(schema, expr, "FloatVectorField", &planpb.QueryInfo{
Topk: 0,
MetricType: "",
SearchParams: "",
RoundDecimal: 0,
})
assert.NoError(t, err)
expr = `C["0"] < 90`
_, err = CreateSearchPlan(schema, expr, "FloatVectorField", &planpb.QueryInfo{
Topk: 0,
MetricType: "",
SearchParams: "",
RoundDecimal: 0,
})
assert.NoError(t, err)
expr = `C["0"] == 90`
_, err = CreateSearchPlan(schema, expr, "FloatVectorField", &planpb.QueryInfo{
Topk: 0,
MetricType: "",
SearchParams: "",
RoundDecimal: 0,
})
assert.NoError(t, err)
expr = `10 < C["0"] < 90`
_, err = CreateSearchPlan(schema, expr, "FloatVectorField", &planpb.QueryInfo{
Topk: 0,
MetricType: "",
SearchParams: "",
RoundDecimal: 0,
})
assert.NoError(t, err)
expr = `100 > C["0"] > 90`
_, err = CreateSearchPlan(schema, expr, "FloatVectorField", &planpb.QueryInfo{
Topk: 0,
MetricType: "",
SearchParams: "",
RoundDecimal: 0,
})
assert.NoError(t, err)
expr = `0 <= JSONField["A"] < 5`
_, err = CreateSearchPlan(schema, expr, "FloatVectorField", &planpb.QueryInfo{
Topk: 0,
MetricType: "",
SearchParams: "",
RoundDecimal: 0,
})
assert.NoError(t, err)
expr = `0 <= A < 5`
_, err = CreateSearchPlan(schema, expr, "FloatVectorField", &planpb.QueryInfo{
Topk: 0,
MetricType: "",
SearchParams: "",
RoundDecimal: 0,
})
assert.NoError(t, err)
expr = `JSONField["A"] + 5 == 10`
_, err = CreateSearchPlan(schema, expr, "FloatVectorField", &planpb.QueryInfo{
Topk: 0,
MetricType: "",
SearchParams: "",
RoundDecimal: 0,
})
assert.NoError(t, err)
expr = `JSONField["A"] > 10 + 5`
_, err = CreateSearchPlan(schema, expr, "FloatVectorField", &planpb.QueryInfo{
Topk: 0,
MetricType: "",
SearchParams: "",
RoundDecimal: 0,
})
assert.NoError(t, err)
expr = `100 - 5 < JSONField["A"]`
_, err = CreateSearchPlan(schema, expr, "FloatVectorField", &planpb.QueryInfo{
Topk: 0,
MetricType: "",
SearchParams: "",
RoundDecimal: 0,
})
assert.NoError(t, err)
expr = `100 == JSONField["A"] + 6`
_, err = CreateSearchPlan(schema, expr, "FloatVectorField", &planpb.QueryInfo{
Topk: 0,
MetricType: "",
SearchParams: "",
RoundDecimal: 0,
})
assert.NoError(t, err)
expr = `exists JSONField["A"]`
_, err = CreateSearchPlan(schema, expr, "FloatVectorField", &planpb.QueryInfo{
Topk: 0,
MetricType: "",
SearchParams: "",
RoundDecimal: 0,
})
assert.NoError(t, err)
expr = `exists JSONField["A"] > 10 `
_, err = CreateSearchPlan(schema, expr, "FloatVectorField", &planpb.QueryInfo{
Topk: 0,
MetricType: "",
SearchParams: "",
RoundDecimal: 0,
})
assert.Error(t, err)
expr = `exists Int64Field `
_, err = CreateSearchPlan(schema, expr, "FloatVectorField", &planpb.QueryInfo{
Topk: 0,
MetricType: "",
SearchParams: "",
RoundDecimal: 0,
})
assert.Error(t, err)
expr = `exists JSONField["A"]["B"]["C"] `
_, err = CreateSearchPlan(schema, expr, "FloatVectorField", &planpb.QueryInfo{
Topk: 0,
MetricType: "",
SearchParams: "",
RoundDecimal: 0,
})
assert.NoError(t, err)
expr = `A["B"][0] > 100`
_, err = CreateSearchPlan(schema, expr, "FloatVectorField", &planpb.QueryInfo{
Topk: 0,
MetricType: "",
SearchParams: "",
RoundDecimal: 0,
})
assert.NoError(t, err)
}
func Test_InvalidExprOnJSONField(t *testing.T) {
schema := newTestSchema()
expr := ""
var err error
expr = `exists JSONField`
_, err = CreateSearchPlan(schema, expr, "FloatVectorField", &planpb.QueryInfo{
Topk: 0,
MetricType: "",
SearchParams: "",
RoundDecimal: 0,
})
assert.Error(t, err)
expr = `JSONField > 0`
_, err = CreateSearchPlan(schema, expr, "FloatVectorField", &planpb.QueryInfo{
Topk: 0,
MetricType: "",
SearchParams: "",
RoundDecimal: 0,
})
assert.Error(t, err)
expr = `JSONField == 0`
_, err = CreateSearchPlan(schema, expr, "FloatVectorField", &planpb.QueryInfo{
Topk: 0,
MetricType: "",
SearchParams: "",
RoundDecimal: 0,
})
assert.Error(t, err)
expr = `JSONField < 100`
_, err = CreateSearchPlan(schema, expr, "FloatVectorField", &planpb.QueryInfo{
Topk: 0,
MetricType: "",
SearchParams: "",
RoundDecimal: 0,
})
assert.Error(t, err)
expr = `0 < JSONField < 100`
_, err = CreateSearchPlan(schema, expr, "FloatVectorField", &planpb.QueryInfo{
Topk: 0,
MetricType: "",
SearchParams: "",
RoundDecimal: 0,
})
assert.Error(t, err)
expr = `20 > JSONField > 0`
_, err = CreateSearchPlan(schema, expr, "FloatVectorField", &planpb.QueryInfo{
Topk: 0,
MetricType: "",
SearchParams: "",
RoundDecimal: 0,
})
assert.Error(t, err)
expr = `JSONField + 5 > 0`
_, err = CreateSearchPlan(schema, expr, "FloatVectorField", &planpb.QueryInfo{
Topk: 0,
MetricType: "",
SearchParams: "",
RoundDecimal: 0,
})
assert.Error(t, err)
expr = `JSONField > 2 + 5`
_, err = CreateSearchPlan(schema, expr, "FloatVectorField", &planpb.QueryInfo{
Topk: 0,
MetricType: "",
SearchParams: "",
RoundDecimal: 0,
})
assert.Error(t, err)
}
func Test_InvalidExprWithoutJSONField(t *testing.T) {
fields := []*schemapb.FieldSchema{
{FieldID: 100, Name: "id", IsPrimaryKey: true, Description: "id", DataType: schemapb.DataType_Int64},
{FieldID: 101, Name: "vector", IsPrimaryKey: false, Description: "vector", DataType: schemapb.DataType_FloatVector},
}
schema := &schemapb.CollectionSchema{
Name: "test",
Description: "schema for test used",
AutoID: true,
Fields: fields,
}
expr := ""
var err error
expr = `A == 0`
_, err = CreateSearchPlan(schema, expr, "FloatVectorField", &planpb.QueryInfo{
Topk: 0,
MetricType: "",
SearchParams: "",
RoundDecimal: 0,
})
assert.Error(t, err)
expr = `JSON["A"] > 0`
_, err = CreateSearchPlan(schema, expr, "FloatVectorField", &planpb.QueryInfo{
Topk: 0,
MetricType: "",
SearchParams: "",
RoundDecimal: 0,
})
assert.Error(t, err)
expr = `A < 100`
_, err = CreateSearchPlan(schema, expr, "FloatVectorField", &planpb.QueryInfo{
Topk: 0,
MetricType: "",
SearchParams: "",
RoundDecimal: 0,
})
assert.Error(t, err)
expr = `0 < JSON["A"] < 100`
_, err = CreateSearchPlan(schema, expr, "FloatVectorField", &planpb.QueryInfo{
Topk: 0,
MetricType: "",
SearchParams: "",
RoundDecimal: 0,
})
assert.Error(t, err)
expr = `0 < A < 100`
_, err = CreateSearchPlan(schema, expr, "FloatVectorField", &planpb.QueryInfo{
Topk: 0,
MetricType: "",
SearchParams: "",
RoundDecimal: 0,
})
assert.Error(t, err)
expr = `100 > JSON["A"] > 0`
_, err = CreateSearchPlan(schema, expr, "FloatVectorField", &planpb.QueryInfo{
Topk: 0,
MetricType: "",
SearchParams: "",
RoundDecimal: 0,
})
assert.Error(t, err)
expr = `100 > A > 0`
_, err = CreateSearchPlan(schema, expr, "FloatVectorField", &planpb.QueryInfo{
Topk: 0,
MetricType: "",
SearchParams: "",
RoundDecimal: 0,
})
assert.Error(t, err)
}
func Test_InvalidExprWithMultipleJSONField(t *testing.T) {
fields := []*schemapb.FieldSchema{
{FieldID: 100, Name: "id", IsPrimaryKey: true, Description: "id", DataType: schemapb.DataType_Int64},
{FieldID: 101, Name: "vector", IsPrimaryKey: false, Description: "vector", DataType: schemapb.DataType_FloatVector},
{FieldID: 102, Name: "json1", IsPrimaryKey: false, Description: "json field 1", DataType: schemapb.DataType_JSON},
{FieldID: 103, Name: "json2", IsPrimaryKey: false, Description: "json field 2", DataType: schemapb.DataType_JSON},
}
schema := &schemapb.CollectionSchema{
Name: "test",
Description: "schema for test used",
AutoID: true,
Fields: fields,
}
expr := ""
var err error
expr = `A == 0`
_, err = CreateSearchPlan(schema, expr, "FloatVectorField", &planpb.QueryInfo{
Topk: 0,
MetricType: "",
SearchParams: "",
RoundDecimal: 0,
})
assert.Error(t, err)
}

View File

@ -113,6 +113,9 @@ func toValueExpr(n *planpb.GenericValue) *ExprWithType {
}
func getSameType(a, b schemapb.DataType) (schemapb.DataType, error) {
if hasJSONField(a, b) {
return schemapb.DataType_JSON, nil
}
if typeutil.IsFloatingType(a) && typeutil.IsArithmetic(b) {
return schemapb.DataType_Double, nil
}
@ -124,6 +127,13 @@ func getSameType(a, b schemapb.DataType) (schemapb.DataType, error) {
return schemapb.DataType_None, fmt.Errorf("incompatible data type, %s, %s", a.String(), b.String())
}
func hasJSONField(a, b schemapb.DataType) bool {
if typeutil.IsJSONType(a) || typeutil.IsJSONType(b) {
return true
}
return false
}
func calcDataType(left, right *ExprWithType, reverse bool) (schemapb.DataType, error) {
if reverse {
return getSameType(right.dataType, left.dataType)
@ -155,6 +165,9 @@ func toColumnInfo(left *ExprWithType) *planpb.ColumnInfo {
}
func castValue(dataType schemapb.DataType, value *planpb.GenericValue) (*planpb.GenericValue, error) {
if typeutil.IsJSONType(dataType) {
return value, nil
}
if typeutil.IsStringType(dataType) && IsString(value) {
return value, nil
}
@ -307,7 +320,7 @@ func handleCompare(op planpb.OpType, left *ExprWithType, right *ExprWithType) (*
}
func relationalCompatible(t1, t2 schemapb.DataType) bool {
both := typeutil.IsStringType(t1) && typeutil.IsStringType(t2)
both := (typeutil.IsStringType(t1) || typeutil.IsJSONType(t1)) && (typeutil.IsStringType(t2) || typeutil.IsJSONType(t2))
neither := !typeutil.IsStringType(t1) && !typeutil.IsStringType(t2)
return both || neither
}

View File

@ -57,6 +57,10 @@ message ColumnExpr {
ColumnInfo info = 1;
}
message ExistsExpr {
ColumnInfo info = 1;
}
message ValueExpr {
GenericValue value = 1;
}
@ -138,6 +142,7 @@ message Expr {
BinaryArithExpr binary_arith_expr = 8;
ValueExpr value_expr = 9;
ColumnExpr column_expr = 10;
ExistsExpr exists_expr = 11;
};
}

View File

@ -138,7 +138,7 @@ func (x UnaryExpr_UnaryOp) String() string {
}
func (UnaryExpr_UnaryOp) EnumDescriptor() ([]byte, []int) {
return fileDescriptor_2d655ab2f7683c23, []int{9, 0}
return fileDescriptor_2d655ab2f7683c23, []int{10, 0}
}
type BinaryExpr_BinaryOp int32
@ -166,7 +166,7 @@ func (x BinaryExpr_BinaryOp) String() string {
}
func (BinaryExpr_BinaryOp) EnumDescriptor() ([]byte, []int) {
return fileDescriptor_2d655ab2f7683c23, []int{10, 0}
return fileDescriptor_2d655ab2f7683c23, []int{11, 0}
}
type GenericValue struct {
@ -452,6 +452,45 @@ func (m *ColumnExpr) GetInfo() *ColumnInfo {
return nil
}
type ExistsExpr struct {
Info *ColumnInfo `protobuf:"bytes,1,opt,name=info,proto3" json:"info,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *ExistsExpr) Reset() { *m = ExistsExpr{} }
func (m *ExistsExpr) String() string { return proto.CompactTextString(m) }
func (*ExistsExpr) ProtoMessage() {}
func (*ExistsExpr) Descriptor() ([]byte, []int) {
return fileDescriptor_2d655ab2f7683c23, []int{4}
}
func (m *ExistsExpr) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ExistsExpr.Unmarshal(m, b)
}
func (m *ExistsExpr) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_ExistsExpr.Marshal(b, m, deterministic)
}
func (m *ExistsExpr) XXX_Merge(src proto.Message) {
xxx_messageInfo_ExistsExpr.Merge(m, src)
}
func (m *ExistsExpr) XXX_Size() int {
return xxx_messageInfo_ExistsExpr.Size(m)
}
func (m *ExistsExpr) XXX_DiscardUnknown() {
xxx_messageInfo_ExistsExpr.DiscardUnknown(m)
}
var xxx_messageInfo_ExistsExpr proto.InternalMessageInfo
func (m *ExistsExpr) GetInfo() *ColumnInfo {
if m != nil {
return m.Info
}
return nil
}
type ValueExpr struct {
Value *GenericValue `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
@ -463,7 +502,7 @@ func (m *ValueExpr) Reset() { *m = ValueExpr{} }
func (m *ValueExpr) String() string { return proto.CompactTextString(m) }
func (*ValueExpr) ProtoMessage() {}
func (*ValueExpr) Descriptor() ([]byte, []int) {
return fileDescriptor_2d655ab2f7683c23, []int{4}
return fileDescriptor_2d655ab2f7683c23, []int{5}
}
func (m *ValueExpr) XXX_Unmarshal(b []byte) error {
@ -504,7 +543,7 @@ func (m *UnaryRangeExpr) Reset() { *m = UnaryRangeExpr{} }
func (m *UnaryRangeExpr) String() string { return proto.CompactTextString(m) }
func (*UnaryRangeExpr) ProtoMessage() {}
func (*UnaryRangeExpr) Descriptor() ([]byte, []int) {
return fileDescriptor_2d655ab2f7683c23, []int{5}
return fileDescriptor_2d655ab2f7683c23, []int{6}
}
func (m *UnaryRangeExpr) XXX_Unmarshal(b []byte) error {
@ -561,7 +600,7 @@ func (m *BinaryRangeExpr) Reset() { *m = BinaryRangeExpr{} }
func (m *BinaryRangeExpr) String() string { return proto.CompactTextString(m) }
func (*BinaryRangeExpr) ProtoMessage() {}
func (*BinaryRangeExpr) Descriptor() ([]byte, []int) {
return fileDescriptor_2d655ab2f7683c23, []int{6}
return fileDescriptor_2d655ab2f7683c23, []int{7}
}
func (m *BinaryRangeExpr) XXX_Unmarshal(b []byte) error {
@ -630,7 +669,7 @@ func (m *CompareExpr) Reset() { *m = CompareExpr{} }
func (m *CompareExpr) String() string { return proto.CompactTextString(m) }
func (*CompareExpr) ProtoMessage() {}
func (*CompareExpr) Descriptor() ([]byte, []int) {
return fileDescriptor_2d655ab2f7683c23, []int{7}
return fileDescriptor_2d655ab2f7683c23, []int{8}
}
func (m *CompareExpr) XXX_Unmarshal(b []byte) error {
@ -684,7 +723,7 @@ func (m *TermExpr) Reset() { *m = TermExpr{} }
func (m *TermExpr) String() string { return proto.CompactTextString(m) }
func (*TermExpr) ProtoMessage() {}
func (*TermExpr) Descriptor() ([]byte, []int) {
return fileDescriptor_2d655ab2f7683c23, []int{8}
return fileDescriptor_2d655ab2f7683c23, []int{9}
}
func (m *TermExpr) XXX_Unmarshal(b []byte) error {
@ -731,7 +770,7 @@ func (m *UnaryExpr) Reset() { *m = UnaryExpr{} }
func (m *UnaryExpr) String() string { return proto.CompactTextString(m) }
func (*UnaryExpr) ProtoMessage() {}
func (*UnaryExpr) Descriptor() ([]byte, []int) {
return fileDescriptor_2d655ab2f7683c23, []int{9}
return fileDescriptor_2d655ab2f7683c23, []int{10}
}
func (m *UnaryExpr) XXX_Unmarshal(b []byte) error {
@ -779,7 +818,7 @@ func (m *BinaryExpr) Reset() { *m = BinaryExpr{} }
func (m *BinaryExpr) String() string { return proto.CompactTextString(m) }
func (*BinaryExpr) ProtoMessage() {}
func (*BinaryExpr) Descriptor() ([]byte, []int) {
return fileDescriptor_2d655ab2f7683c23, []int{10}
return fileDescriptor_2d655ab2f7683c23, []int{11}
}
func (m *BinaryExpr) XXX_Unmarshal(b []byte) error {
@ -834,7 +873,7 @@ func (m *BinaryArithOp) Reset() { *m = BinaryArithOp{} }
func (m *BinaryArithOp) String() string { return proto.CompactTextString(m) }
func (*BinaryArithOp) ProtoMessage() {}
func (*BinaryArithOp) Descriptor() ([]byte, []int) {
return fileDescriptor_2d655ab2f7683c23, []int{11}
return fileDescriptor_2d655ab2f7683c23, []int{12}
}
func (m *BinaryArithOp) XXX_Unmarshal(b []byte) error {
@ -889,7 +928,7 @@ func (m *BinaryArithExpr) Reset() { *m = BinaryArithExpr{} }
func (m *BinaryArithExpr) String() string { return proto.CompactTextString(m) }
func (*BinaryArithExpr) ProtoMessage() {}
func (*BinaryArithExpr) Descriptor() ([]byte, []int) {
return fileDescriptor_2d655ab2f7683c23, []int{12}
return fileDescriptor_2d655ab2f7683c23, []int{13}
}
func (m *BinaryArithExpr) XXX_Unmarshal(b []byte) error {
@ -946,7 +985,7 @@ func (m *BinaryArithOpEvalRangeExpr) Reset() { *m = BinaryArithOpEvalRan
func (m *BinaryArithOpEvalRangeExpr) String() string { return proto.CompactTextString(m) }
func (*BinaryArithOpEvalRangeExpr) ProtoMessage() {}
func (*BinaryArithOpEvalRangeExpr) Descriptor() ([]byte, []int) {
return fileDescriptor_2d655ab2f7683c23, []int{13}
return fileDescriptor_2d655ab2f7683c23, []int{14}
}
func (m *BinaryArithOpEvalRangeExpr) XXX_Unmarshal(b []byte) error {
@ -1014,6 +1053,7 @@ type Expr struct {
// *Expr_BinaryArithExpr
// *Expr_ValueExpr
// *Expr_ColumnExpr
// *Expr_ExistsExpr
Expr isExpr_Expr `protobuf_oneof:"expr"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
@ -1024,7 +1064,7 @@ func (m *Expr) Reset() { *m = Expr{} }
func (m *Expr) String() string { return proto.CompactTextString(m) }
func (*Expr) ProtoMessage() {}
func (*Expr) Descriptor() ([]byte, []int) {
return fileDescriptor_2d655ab2f7683c23, []int{14}
return fileDescriptor_2d655ab2f7683c23, []int{15}
}
func (m *Expr) XXX_Unmarshal(b []byte) error {
@ -1089,6 +1129,10 @@ type Expr_ColumnExpr struct {
ColumnExpr *ColumnExpr `protobuf:"bytes,10,opt,name=column_expr,json=columnExpr,proto3,oneof"`
}
type Expr_ExistsExpr struct {
ExistsExpr *ExistsExpr `protobuf:"bytes,11,opt,name=exists_expr,json=existsExpr,proto3,oneof"`
}
func (*Expr_TermExpr) isExpr_Expr() {}
func (*Expr_UnaryExpr) isExpr_Expr() {}
@ -1109,6 +1153,8 @@ func (*Expr_ValueExpr) isExpr_Expr() {}
func (*Expr_ColumnExpr) isExpr_Expr() {}
func (*Expr_ExistsExpr) isExpr_Expr() {}
func (m *Expr) GetExpr() isExpr_Expr {
if m != nil {
return m.Expr
@ -1186,6 +1232,13 @@ func (m *Expr) GetColumnExpr() *ColumnExpr {
return nil
}
func (m *Expr) GetExistsExpr() *ExistsExpr {
if x, ok := m.GetExpr().(*Expr_ExistsExpr); ok {
return x.ExistsExpr
}
return nil
}
// XXX_OneofWrappers is for the internal use of the proto package.
func (*Expr) XXX_OneofWrappers() []interface{} {
return []interface{}{
@ -1199,6 +1252,7 @@ func (*Expr) XXX_OneofWrappers() []interface{} {
(*Expr_BinaryArithExpr)(nil),
(*Expr_ValueExpr)(nil),
(*Expr_ColumnExpr)(nil),
(*Expr_ExistsExpr)(nil),
}
}
@ -1217,7 +1271,7 @@ func (m *VectorANNS) Reset() { *m = VectorANNS{} }
func (m *VectorANNS) String() string { return proto.CompactTextString(m) }
func (*VectorANNS) ProtoMessage() {}
func (*VectorANNS) Descriptor() ([]byte, []int) {
return fileDescriptor_2d655ab2f7683c23, []int{15}
return fileDescriptor_2d655ab2f7683c23, []int{16}
}
func (m *VectorANNS) XXX_Unmarshal(b []byte) error {
@ -1285,7 +1339,7 @@ func (m *QueryPlanNode) Reset() { *m = QueryPlanNode{} }
func (m *QueryPlanNode) String() string { return proto.CompactTextString(m) }
func (*QueryPlanNode) ProtoMessage() {}
func (*QueryPlanNode) Descriptor() ([]byte, []int) {
return fileDescriptor_2d655ab2f7683c23, []int{16}
return fileDescriptor_2d655ab2f7683c23, []int{17}
}
func (m *QueryPlanNode) XXX_Unmarshal(b []byte) error {
@ -1336,7 +1390,7 @@ func (m *PlanNode) Reset() { *m = PlanNode{} }
func (m *PlanNode) String() string { return proto.CompactTextString(m) }
func (*PlanNode) ProtoMessage() {}
func (*PlanNode) Descriptor() ([]byte, []int) {
return fileDescriptor_2d655ab2f7683c23, []int{17}
return fileDescriptor_2d655ab2f7683c23, []int{18}
}
func (m *PlanNode) XXX_Unmarshal(b []byte) error {
@ -1432,6 +1486,7 @@ func init() {
proto.RegisterType((*QueryInfo)(nil), "milvus.proto.plan.QueryInfo")
proto.RegisterType((*ColumnInfo)(nil), "milvus.proto.plan.ColumnInfo")
proto.RegisterType((*ColumnExpr)(nil), "milvus.proto.plan.ColumnExpr")
proto.RegisterType((*ExistsExpr)(nil), "milvus.proto.plan.ExistsExpr")
proto.RegisterType((*ValueExpr)(nil), "milvus.proto.plan.ValueExpr")
proto.RegisterType((*UnaryRangeExpr)(nil), "milvus.proto.plan.UnaryRangeExpr")
proto.RegisterType((*BinaryRangeExpr)(nil), "milvus.proto.plan.BinaryRangeExpr")
@ -1451,98 +1506,99 @@ func init() {
func init() { proto.RegisterFile("plan.proto", fileDescriptor_2d655ab2f7683c23) }
var fileDescriptor_2d655ab2f7683c23 = []byte{
// 1477 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x57, 0x3f, 0x73, 0xdb, 0xc6,
0x12, 0x27, 0x08, 0x52, 0x04, 0x96, 0x14, 0x05, 0xa3, 0x79, 0xb2, 0xfd, 0x6c, 0xe9, 0xe1, 0x79,
0x9e, 0xf5, 0xfc, 0xc6, 0xd2, 0xf8, 0xd9, 0xcf, 0x7e, 0x76, 0xc6, 0x89, 0xfe, 0x39, 0x22, 0x27,
0xb6, 0xa4, 0xc0, 0xb2, 0x8a, 0x34, 0x98, 0x23, 0x70, 0x12, 0x6f, 0x0c, 0xde, 0xc1, 0xc0, 0x81,
0xb6, 0xea, 0x74, 0xe9, 0xf2, 0x01, 0x52, 0xa7, 0x4f, 0x99, 0x26, 0x65, 0x9a, 0x14, 0x29, 0xd3,
0xe7, 0x23, 0xa4, 0x4b, 0x95, 0xb9, 0x3d, 0xf0, 0x9f, 0x86, 0xb4, 0xa8, 0x89, 0x67, 0xd2, 0x1d,
0xf6, 0x76, 0x7f, 0xb7, 0xfb, 0xdb, 0xbd, 0xbd, 0x05, 0x40, 0x12, 0x13, 0xbe, 0x9e, 0xa4, 0x42,
0x0a, 0xf7,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d4, 0x8c, 0x53, 0x03, 0xf3, 0x65, 0xde,
0x71, 0xca, 0x6a, 0xf1, 0x22, 0x8f, 0x1d, 0x53, 0x2d, 0x76, 0x59, 0xdf, 0xa9, 0xa0, 0x44, 0x44,
0x4e, 0x75, 0xfb, 0xfe, 0x17, 0xf7, 0x4e, 0x99, 0xec, 0xe6, 0x9d, 0xf5, 0x50, 0xf4, 0x36, 0x34,
0xdd, 0x77, 0x99, 0x28, 0x56, 0x1b, 0x8c, 0x4b, 0x9a, 0x72, 0x12, 0x6f, 0x60, 0x06, 0x36, 0x54,
0x06, 0x92, 0x4e, 0x67, 0x01, 0xbf, 0xee, 0xff, 0x11, 0x00, 0x00, 0xff, 0xff, 0x80, 0xc6, 0x4c,
0xe0, 0x76, 0x10, 0x00, 0x00,
// 1504 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x57, 0xcd, 0x72, 0xdc, 0x36,
0x12, 0x1e, 0xce, 0x2f, 0xd9, 0x33, 0x1a, 0xd1, 0xbc, 0xac, 0x6c, 0xaf, 0x2d, 0x2d, 0xd7, 0xb5,
0xd6, 0x7a, 0xcb, 0x52, 0x79, 0xed, 0xb5, 0xd7, 0xde, 0xf2, 0x46, 0xbf, 0xd1, 0x4c, 0xc5, 0x96,
0x14, 0x5a, 0xd6, 0x21, 0x17, 0x16, 0x86, 0x84, 0x34, 0x28, 0x73, 0x00, 0x9a, 0x04, 0xc7, 0xd2,
0x39, 0xb7, 0xdc, 0xf2, 0x00, 0x39, 0xe7, 0x9e, 0x63, 0x2a, 0x55, 0x39, 0xe6, 0x92, 0x43, 0x8e,
0xb9, 0xe7, 0x11, 0xf2, 0x02, 0x29, 0x34, 0x38, 0x7f, 0xaa, 0x19, 0x6b, 0x94, 0xb8, 0x2a, 0x37,
0xa0, 0x81, 0xfe, 0xd0, 0xfd, 0x75, 0xa3, 0xd1, 0x00, 0x88, 0x23, 0x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x73, 0xbb, 0xae, 0x44, 0xfb, 0x42, 0xb6, 0xb9,
0xdd, 0xb8, 0xb7, 0x07, 0xf5, 0xb1, 0xc7, 0x4f, 0x39, 0xf0, 0x9a, 0xbf, 0xe1, 0xe2, 0x1d, 0xd7,
0x1d, 0xdf, 0x66, 0xa8, 0xba, 0xa4, 0x1a, 0x94, 0x5e, 0x65, 0x1d, 0xbb, 0xa8, 0x06, 0x2f, 0xb3,
0xc8, 0x2e, 0xa9, 0xc1, 0x0e, 0xeb, 0xdb, 0x65, 0x94, 0x88, 0xd0, 0xae, 0x6c, 0x3d, 0xfc, 0xec,
0xc1, 0x29, 0x93, 0xdd, 0xac, 0xb3, 0x16, 0x88, 0xde, 0xba, 0xa6, 0xfb, 0x3e, 0x13, 0xf9, 0x68,
0x9d, 0x71, 0x49, 0x13, 0x4e, 0xa2, 0x75, 0x8c, 0xc0, 0xba, 0x8a, 0x40, 0xdc, 0xe9, 0x54, 0x71,
0xf6, 0xf0, 0xb7, 0x00, 0x00, 0x00, 0xff, 0xff, 0xb4, 0x92, 0xa4, 0xfa, 0xf9, 0x10, 0x00, 0x00,
}

View File

@ -236,6 +236,37 @@ func (helper *SchemaHelper) GetFieldFromName(fieldName string) (*schemapb.FieldS
return helper.schema.Fields[offset], nil
}
// GetFieldFromNameDefaultJSON is used to find the schema by field name, if not exist, use json field
func (helper *SchemaHelper) GetFieldFromNameDefaultJSON(fieldName string) (*schemapb.FieldSchema, error) {
offset, ok := helper.nameOffset[fieldName]
if !ok {
return helper.getDefaultJSONField()
}
return helper.schema.Fields[offset], nil
}
func (helper *SchemaHelper) getDefaultJSONField() (*schemapb.FieldSchema, error) {
var field *schemapb.FieldSchema
for _, f := range helper.schema.GetFields() {
// TODO @xiaocai2333: get $SYS_META json field
if f.DataType == schemapb.DataType_JSON {
if field != nil {
// TODO @xiaocai2333: will not return error after support $SYS_META
errMsg := "there is multi json field in schema, need to specified field name"
log.Warn(errMsg)
return nil, fmt.Errorf(errMsg)
}
field = f
}
}
if field == nil {
errMsg := "there is no json field in schema, need to specified field name"
log.Warn(errMsg)
return nil, fmt.Errorf(errMsg)
}
return field, nil
}
// GetFieldFromID returns the schema of specified field
func (helper *SchemaHelper) GetFieldFromID(fieldID int64) (*schemapb.FieldSchema, error) {
offset, ok := helper.idOffset[fieldID]
@ -287,6 +318,10 @@ func IsIntegerType(dataType schemapb.DataType) bool {
}
}
func IsJSONType(dataType schemapb.DataType) bool {
return dataType == schemapb.DataType_JSON
}
// IsFloatingType returns true if input is a floating type, otherwise false
func IsFloatingType(dataType schemapb.DataType) bool {
switch dataType {

View File

@ -0,0 +1,613 @@
// Licensed to the LF AI & Data foundation under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you 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.
package integration
import (
"context"
"encoding/json"
"fmt"
"strconv"
"testing"
"time"
"github.com/cockroachdb/errors"
"github.com/milvus-io/milvus/pkg/common"
"github.com/milvus-io/milvus/pkg/util/distance"
"github.com/golang/protobuf/proto"
"github.com/milvus-io/milvus-proto/go-api/commonpb"
"github.com/milvus-io/milvus-proto/go-api/milvuspb"
"github.com/milvus-io/milvus-proto/go-api/schemapb"
"github.com/milvus-io/milvus/pkg/log"
"github.com/milvus-io/milvus/pkg/util/funcutil"
"github.com/stretchr/testify/assert"
"go.uber.org/zap"
)
func TestJsonExpr(t *testing.T) {
ctx := context.Background()
c, err := StartMiniCluster(ctx)
assert.NoError(t, err)
err = c.Start()
assert.NoError(t, err)
defer c.Stop()
assert.NoError(t, err)
prefix := "TestHelloMilvus"
dbName := ""
collectionName := prefix + funcutil.GenRandomStr()
jsonField := "json"
dim := 128
rowNum := 100
constructCollectionSchema := func() *schemapb.CollectionSchema {
pk := &schemapb.FieldSchema{
FieldID: 0,
Name: int64Field,
IsPrimaryKey: true,
Description: "",
DataType: schemapb.DataType_Int64,
TypeParams: nil,
IndexParams: nil,
AutoID: true,
}
fVec := &schemapb.FieldSchema{
FieldID: 0,
Name: floatVecField,
IsPrimaryKey: false,
Description: "",
DataType: schemapb.DataType_FloatVector,
TypeParams: []*commonpb.KeyValuePair{
{
Key: "dim",
Value: strconv.Itoa(dim),
},
},
IndexParams: nil,
AutoID: false,
}
jsonF := &schemapb.FieldSchema{
Name: jsonField,
Description: "this is a json field",
DataType: schemapb.DataType_JSON,
}
return &schemapb.CollectionSchema{
Name: collectionName,
Description: "",
AutoID: false,
Fields: []*schemapb.FieldSchema{
pk,
fVec,
jsonF,
},
}
}
schema := constructCollectionSchema()
marshaledSchema, err := proto.Marshal(schema)
assert.NoError(t, err)
createCollectionStatus, err := c.proxy.CreateCollection(ctx, &milvuspb.CreateCollectionRequest{
DbName: dbName,
CollectionName: collectionName,
Schema: marshaledSchema,
ShardsNum: 2,
})
assert.NoError(t, err)
if createCollectionStatus.GetErrorCode() != commonpb.ErrorCode_Success {
log.Warn("createCollectionStatus fail reason", zap.String("reason", createCollectionStatus.GetReason()))
}
assert.Equal(t, createCollectionStatus.GetErrorCode(), commonpb.ErrorCode_Success)
log.Info("CreateCollection result", zap.Any("createCollectionStatus", createCollectionStatus))
showCollectionsResp, err := c.proxy.ShowCollections(ctx, &milvuspb.ShowCollectionsRequest{})
assert.NoError(t, err)
assert.Equal(t, showCollectionsResp.GetStatus().GetErrorCode(), commonpb.ErrorCode_Success)
log.Info("ShowCollections result", zap.Any("showCollectionsResp", showCollectionsResp))
fVecColumn := newFloatVectorFieldData(floatVecField, rowNum, dim)
jsonData := newJSONData(jsonField, rowNum)
hashKeys := generateHashKeys(rowNum)
insertResult, err := c.proxy.Insert(ctx, &milvuspb.InsertRequest{
DbName: dbName,
CollectionName: collectionName,
FieldsData: []*schemapb.FieldData{fVecColumn, jsonData},
HashKeys: hashKeys,
NumRows: uint32(rowNum),
})
assert.NoError(t, err)
assert.Equal(t, insertResult.GetStatus().GetErrorCode(), commonpb.ErrorCode_Success)
// flush
flushResp, err := c.proxy.Flush(ctx, &milvuspb.FlushRequest{
DbName: dbName,
CollectionNames: []string{collectionName},
})
assert.NoError(t, err)
segmentIDs, has := flushResp.GetCollSegIDs()[collectionName]
ids := segmentIDs.GetData()
assert.NotEmpty(t, segmentIDs)
segments, err := c.metaWatcher.ShowSegments()
assert.NoError(t, err)
assert.NotEmpty(t, segments)
for _, segment := range segments {
log.Info("ShowSegments result", zap.String("segment", segment.String()))
}
if has && len(ids) > 0 {
flushed := func() bool {
resp, err := c.proxy.GetFlushState(ctx, &milvuspb.GetFlushStateRequest{
SegmentIDs: ids,
})
if err != nil {
//panic(errors.New("GetFlushState failed"))
return false
}
return resp.GetFlushed()
}
for !flushed() {
// respect context deadline/cancel
select {
case <-ctx.Done():
panic(errors.New("deadline exceeded"))
default:
}
time.Sleep(500 * time.Millisecond)
}
}
// create index
createIndexStatus, err := c.proxy.CreateIndex(ctx, &milvuspb.CreateIndexRequest{
CollectionName: collectionName,
FieldName: floatVecField,
IndexName: "_default",
ExtraParams: []*commonpb.KeyValuePair{
{
Key: "dim",
Value: strconv.Itoa(dim),
},
{
Key: common.MetricTypeKey,
Value: distance.L2,
},
{
Key: "index_type",
Value: "IVF_FLAT",
},
{
Key: "nlist",
Value: strconv.Itoa(10),
},
},
})
if createIndexStatus.GetErrorCode() != commonpb.ErrorCode_Success {
log.Warn("createIndexStatus fail reason", zap.String("reason", createIndexStatus.GetReason()))
}
assert.NoError(t, err)
assert.Equal(t, commonpb.ErrorCode_Success, createIndexStatus.GetErrorCode())
// load
loadStatus, err := c.proxy.LoadCollection(ctx, &milvuspb.LoadCollectionRequest{
DbName: dbName,
CollectionName: collectionName,
})
assert.NoError(t, err)
if loadStatus.GetErrorCode() != commonpb.ErrorCode_Success {
log.Warn("loadStatus fail reason", zap.String("reason", loadStatus.GetReason()))
}
assert.Equal(t, commonpb.ErrorCode_Success, loadStatus.GetErrorCode())
for {
loadProgress, err := c.proxy.GetLoadingProgress(ctx, &milvuspb.GetLoadingProgressRequest{
CollectionName: collectionName,
})
if err != nil {
panic("GetLoadingProgress fail")
}
if loadProgress.GetProgress() == 100 {
break
}
time.Sleep(500 * time.Millisecond)
}
expr := ""
// search
expr = `json["A"] > 90`
checkFunc := func(result *milvuspb.SearchResults) {
assert.Equal(t, 1, len(result.Results.FieldsData))
assert.Equal(t, jsonField, result.Results.FieldsData[0].GetFieldName())
assert.Equal(t, schemapb.DataType_JSON, result.Results.FieldsData[0].GetType())
assert.Equal(t, 5, len(result.Results.FieldsData[0].GetScalars().GetJsonData().GetData()))
}
doSearch(c, collectionName, []string{jsonField}, expr, dim, t, checkFunc)
log.Info("GT expression run successfully")
expr = `json["A"] < 10`
checkFunc = func(result *milvuspb.SearchResults) {
assert.Equal(t, 1, len(result.Results.FieldsData))
assert.Equal(t, jsonField, result.Results.FieldsData[0].GetFieldName())
assert.Equal(t, schemapb.DataType_JSON, result.Results.FieldsData[0].GetType())
assert.Equal(t, 5, len(result.Results.FieldsData[0].GetScalars().GetJsonData().GetData()))
}
doSearch(c, collectionName, []string{jsonField}, expr, dim, t, checkFunc)
log.Info("LT expression run successfully")
expr = `json["A"] <= 5`
checkFunc = func(result *milvuspb.SearchResults) {
assert.Equal(t, 1, len(result.Results.FieldsData))
assert.Equal(t, jsonField, result.Results.FieldsData[0].GetFieldName())
assert.Equal(t, schemapb.DataType_JSON, result.Results.FieldsData[0].GetType())
assert.Equal(t, 3, len(result.Results.FieldsData[0].GetScalars().GetJsonData().GetData()))
}
doSearch(c, collectionName, []string{jsonField}, expr, dim, t, checkFunc)
log.Info("LE expression run successfully")
expr = `A >= 95`
checkFunc = func(result *milvuspb.SearchResults) {
assert.Equal(t, 1, len(result.Results.FieldsData))
assert.Equal(t, jsonField, result.Results.FieldsData[0].GetFieldName())
assert.Equal(t, schemapb.DataType_JSON, result.Results.FieldsData[0].GetType())
assert.Equal(t, 3, len(result.Results.FieldsData[0].GetScalars().GetJsonData().GetData()))
}
doSearch(c, collectionName, []string{jsonField}, expr, dim, t, checkFunc)
log.Info("GE expression run successfully")
expr = `json["A"] == 5`
checkFunc = func(result *milvuspb.SearchResults) {
assert.Equal(t, 1, len(result.Results.FieldsData))
assert.Equal(t, jsonField, result.Results.FieldsData[0].GetFieldName())
assert.Equal(t, schemapb.DataType_JSON, result.Results.FieldsData[0].GetType())
assert.Equal(t, 1, len(result.Results.FieldsData[0].GetScalars().GetJsonData().GetData()))
}
doSearch(c, collectionName, []string{jsonField}, expr, dim, t, checkFunc)
log.Info("EQ expression run successfully")
expr = `A != 95`
checkFunc = func(result *milvuspb.SearchResults) {
assert.Equal(t, 1, len(result.Results.FieldsData))
assert.Equal(t, jsonField, result.Results.FieldsData[0].GetFieldName())
assert.Equal(t, schemapb.DataType_JSON, result.Results.FieldsData[0].GetType())
assert.Equal(t, 10, len(result.Results.FieldsData[0].GetScalars().GetJsonData().GetData()))
}
doSearch(c, collectionName, []string{jsonField}, expr, dim, t, checkFunc)
log.Info("NE expression run successfully")
expr = `not (A != 95)`
checkFunc = func(result *milvuspb.SearchResults) {
assert.Equal(t, 1, len(result.Results.FieldsData))
assert.Equal(t, jsonField, result.Results.FieldsData[0].GetFieldName())
assert.Equal(t, schemapb.DataType_JSON, result.Results.FieldsData[0].GetType())
assert.Equal(t, 1, len(result.Results.FieldsData[0].GetScalars().GetJsonData().GetData()))
}
doSearch(c, collectionName, []string{jsonField}, expr, dim, t, checkFunc)
log.Info("NOT NE expression run successfully")
expr = `A > 90 && B < 5`
checkFunc = func(result *milvuspb.SearchResults) {
assert.Equal(t, 1, len(result.Results.FieldsData))
assert.Equal(t, jsonField, result.Results.FieldsData[0].GetFieldName())
assert.Equal(t, schemapb.DataType_JSON, result.Results.FieldsData[0].GetType())
assert.Equal(t, 2, len(result.Results.FieldsData[0].GetScalars().GetJsonData().GetData()))
}
doSearch(c, collectionName, []string{jsonField}, expr, dim, t, checkFunc)
log.Info("NE expression run successfully")
expr = `A > 95 || 5 > B`
checkFunc = func(result *milvuspb.SearchResults) {
assert.Equal(t, 1, len(result.Results.FieldsData))
assert.Equal(t, jsonField, result.Results.FieldsData[0].GetFieldName())
assert.Equal(t, schemapb.DataType_JSON, result.Results.FieldsData[0].GetType())
assert.Equal(t, 4, len(result.Results.FieldsData[0].GetScalars().GetJsonData().GetData()))
}
doSearch(c, collectionName, []string{jsonField}, expr, dim, t, checkFunc)
log.Info("NE expression run successfully")
expr = `not (A == 95)`
checkFunc = func(result *milvuspb.SearchResults) {
assert.Equal(t, 1, len(result.Results.FieldsData))
assert.Equal(t, jsonField, result.Results.FieldsData[0].GetFieldName())
assert.Equal(t, schemapb.DataType_JSON, result.Results.FieldsData[0].GetType())
assert.Equal(t, 10, len(result.Results.FieldsData[0].GetScalars().GetJsonData().GetData()))
}
doSearch(c, collectionName, []string{jsonField}, expr, dim, t, checkFunc)
log.Info("NOT expression run successfully")
expr = `A in [90, 91, 95, 97]`
checkFunc = func(result *milvuspb.SearchResults) {
assert.Equal(t, 1, len(result.Results.FieldsData))
assert.Equal(t, jsonField, result.Results.FieldsData[0].GetFieldName())
assert.Equal(t, schemapb.DataType_JSON, result.Results.FieldsData[0].GetType())
assert.Equal(t, 3, len(result.Results.FieldsData[0].GetScalars().GetJsonData().GetData()))
}
doSearch(c, collectionName, []string{jsonField}, expr, dim, t, checkFunc)
log.Info("IN expression run successfully")
expr = `A not in [90, 91, 95, 97]`
checkFunc = func(result *milvuspb.SearchResults) {
assert.Equal(t, 1, len(result.Results.FieldsData))
assert.Equal(t, jsonField, result.Results.FieldsData[0].GetFieldName())
assert.Equal(t, schemapb.DataType_JSON, result.Results.FieldsData[0].GetType())
assert.Equal(t, 10, len(result.Results.FieldsData[0].GetScalars().GetJsonData().GetData()))
}
doSearch(c, collectionName, []string{jsonField}, expr, dim, t, checkFunc)
log.Info("NIN expression run successfully")
expr = `C[0] in [90, 91, 95, 97]`
checkFunc = func(result *milvuspb.SearchResults) {
assert.Equal(t, 1, len(result.Results.FieldsData))
assert.Equal(t, jsonField, result.Results.FieldsData[0].GetFieldName())
assert.Equal(t, schemapb.DataType_JSON, result.Results.FieldsData[0].GetType())
assert.Equal(t, 4, len(result.Results.FieldsData[0].GetScalars().GetJsonData().GetData()))
}
doSearch(c, collectionName, []string{jsonField}, expr, dim, t, checkFunc)
log.Info("IN expression run successfully")
expr = `C[0] not in [90, 91, 95, 97]`
checkFunc = func(result *milvuspb.SearchResults) {
assert.Equal(t, 1, len(result.Results.FieldsData))
assert.Equal(t, jsonField, result.Results.FieldsData[0].GetFieldName())
assert.Equal(t, schemapb.DataType_JSON, result.Results.FieldsData[0].GetType())
assert.Equal(t, 10, len(result.Results.FieldsData[0].GetScalars().GetJsonData().GetData()))
}
doSearch(c, collectionName, []string{jsonField}, expr, dim, t, checkFunc)
log.Info("NIN expression run successfully")
expr = `0 <= A < 5`
checkFunc = func(result *milvuspb.SearchResults) {
assert.Equal(t, 1, len(result.Results.FieldsData))
assert.Equal(t, jsonField, result.Results.FieldsData[0].GetFieldName())
assert.Equal(t, schemapb.DataType_JSON, result.Results.FieldsData[0].GetType())
assert.Equal(t, 2, len(result.Results.FieldsData[0].GetScalars().GetJsonData().GetData()))
}
doSearch(c, collectionName, []string{jsonField}, expr, dim, t, checkFunc)
log.Info("BinaryRange expression run successfully")
expr = `100 > A >= 90`
checkFunc = func(result *milvuspb.SearchResults) {
assert.Equal(t, 1, len(result.Results.FieldsData))
assert.Equal(t, jsonField, result.Results.FieldsData[0].GetFieldName())
assert.Equal(t, schemapb.DataType_JSON, result.Results.FieldsData[0].GetType())
assert.Equal(t, 5, len(result.Results.FieldsData[0].GetScalars().GetJsonData().GetData()))
}
doSearch(c, collectionName, []string{jsonField}, expr, dim, t, checkFunc)
log.Info("BinaryRange expression run successfully")
expr = `1+5 <= A < 5+10`
checkFunc = func(result *milvuspb.SearchResults) {
assert.Equal(t, 1, len(result.Results.FieldsData))
assert.Equal(t, jsonField, result.Results.FieldsData[0].GetFieldName())
assert.Equal(t, schemapb.DataType_JSON, result.Results.FieldsData[0].GetType())
assert.Equal(t, 4, len(result.Results.FieldsData[0].GetScalars().GetJsonData().GetData()))
}
doSearch(c, collectionName, []string{jsonField}, expr, dim, t, checkFunc)
log.Info("BinaryRange expression run successfully")
expr = `A + 5 == 10`
checkFunc = func(result *milvuspb.SearchResults) {
assert.Equal(t, 1, len(result.Results.FieldsData))
assert.Equal(t, jsonField, result.Results.FieldsData[0].GetFieldName())
assert.Equal(t, schemapb.DataType_JSON, result.Results.FieldsData[0].GetType())
assert.Equal(t, 1, len(result.Results.FieldsData[0].GetScalars().GetJsonData().GetData()))
}
doSearch(c, collectionName, []string{jsonField}, expr, dim, t, checkFunc)
log.Info("Arithmetic expression run successfully")
expr = `exists A`
checkFunc = func(result *milvuspb.SearchResults) {
assert.Equal(t, 1, len(result.Results.FieldsData))
assert.Equal(t, jsonField, result.Results.FieldsData[0].GetFieldName())
assert.Equal(t, schemapb.DataType_JSON, result.Results.FieldsData[0].GetType())
assert.Equal(t, 10, len(result.Results.FieldsData[0].GetScalars().GetJsonData().GetData()))
}
doSearch(c, collectionName, []string{jsonField}, expr, dim, t, checkFunc)
log.Info("EXISTS expression run successfully")
expr = `exists AAA`
checkFunc = func(result *milvuspb.SearchResults) {
assert.Equal(t, 0, len(result.Results.FieldsData))
}
doSearch(c, collectionName, []string{jsonField}, expr, dim, t, checkFunc)
log.Info("EXISTS expression run successfully")
expr = `not exists A`
checkFunc = func(result *milvuspb.SearchResults) {
assert.Equal(t, 1, len(result.Results.FieldsData))
assert.Equal(t, jsonField, result.Results.FieldsData[0].GetFieldName())
assert.Equal(t, schemapb.DataType_JSON, result.Results.FieldsData[0].GetType())
assert.Equal(t, 10, len(result.Results.FieldsData[0].GetScalars().GetJsonData().GetData()))
}
doSearch(c, collectionName, []string{jsonField}, expr, dim, t, checkFunc)
log.Info("NOT EXISTS expression run successfully")
expr = `E["G"] > 100`
checkFunc = func(result *milvuspb.SearchResults) {
assert.Equal(t, 1, len(result.Results.FieldsData))
assert.Equal(t, jsonField, result.Results.FieldsData[0].GetFieldName())
assert.Equal(t, schemapb.DataType_JSON, result.Results.FieldsData[0].GetType())
assert.Equal(t, 9, len(result.Results.FieldsData[0].GetScalars().GetJsonData().GetData()))
}
doSearch(c, collectionName, []string{jsonField}, expr, dim, t, checkFunc)
log.Info("nested path expression run successfully")
expr = `D like "name-%"`
checkFunc = func(result *milvuspb.SearchResults) {
assert.Equal(t, 1, len(result.Results.FieldsData))
assert.Equal(t, jsonField, result.Results.FieldsData[0].GetFieldName())
assert.Equal(t, schemapb.DataType_JSON, result.Results.FieldsData[0].GetType())
assert.Equal(t, 10, len(result.Results.FieldsData[0].GetScalars().GetJsonData().GetData()))
}
doSearch(c, collectionName, []string{jsonField}, expr, dim, t, checkFunc)
log.Info("like expression run successfully")
expr = `D like "name-11"`
checkFunc = func(result *milvuspb.SearchResults) {
assert.Equal(t, 1, len(result.Results.FieldsData))
assert.Equal(t, jsonField, result.Results.FieldsData[0].GetFieldName())
assert.Equal(t, schemapb.DataType_JSON, result.Results.FieldsData[0].GetType())
assert.Equal(t, 1, len(result.Results.FieldsData[0].GetScalars().GetJsonData().GetData()))
}
doSearch(c, collectionName, []string{jsonField}, expr, dim, t, checkFunc)
log.Info("like expression run successfully")
expr = `A like "10"`
checkFunc = func(result *milvuspb.SearchResults) {
assert.Equal(t, 0, len(result.Results.FieldsData))
}
doSearch(c, collectionName, []string{jsonField}, expr, dim, t, checkFunc)
log.Info("like expression run successfully")
expr = `A in []`
checkFunc = func(result *milvuspb.SearchResults) {
assert.Equal(t, 0, len(result.Results.FieldsData))
}
doSearch(c, collectionName, []string{jsonField}, expr, dim, t, checkFunc)
log.Info("term empty expression run successfully")
expr = `A not in []`
checkFunc = func(result *milvuspb.SearchResults) {
assert.Equal(t, 1, len(result.Results.FieldsData))
assert.Equal(t, jsonField, result.Results.FieldsData[0].GetFieldName())
assert.Equal(t, schemapb.DataType_JSON, result.Results.FieldsData[0].GetType())
assert.Equal(t, 10, len(result.Results.FieldsData[0].GetScalars().GetJsonData().GetData()))
}
doSearch(c, collectionName, []string{jsonField}, expr, dim, t, checkFunc)
log.Info("term empty expression run successfully")
// invalid expr
expr = `E[F] > 100`
doSearchWithInvalidExpr(c, collectionName, []string{jsonField}, expr, dim, t)
expr = `A >> 10`
doSearchWithInvalidExpr(c, collectionName, []string{jsonField}, expr, dim, t)
expr = `not A > 5`
doSearchWithInvalidExpr(c, collectionName, []string{jsonField}, expr, dim, t)
expr = `not A == 5`
doSearchWithInvalidExpr(c, collectionName, []string{jsonField}, expr, dim, t)
expr = `A > B`
doSearchWithInvalidExpr(c, collectionName, []string{jsonField}, expr, dim, t)
expr = `A > Int64Field`
doSearchWithInvalidExpr(c, collectionName, []string{jsonField}, expr, dim, t)
expr = `A like abc`
doSearchWithInvalidExpr(c, collectionName, []string{jsonField}, expr, dim, t)
expr = `D like "%name-%"`
doSearchWithInvalidExpr(c, collectionName, []string{jsonField}, expr, dim, t)
expr = `D like "na%me"`
doSearchWithInvalidExpr(c, collectionName, []string{jsonField}, expr, dim, t)
expr = `1+5 <= A+1 < 5+10`
doSearchWithInvalidExpr(c, collectionName, []string{jsonField}, expr, dim, t)
expr = `json == ""`
doSearchWithInvalidExpr(c, collectionName, []string{jsonField}, expr, dim, t)
}
func doSearch(cluster *MiniCluster, collectionName string, outputField []string, expr string, dim int, t *testing.T, checkFunc func(results *milvuspb.SearchResults)) {
nq := 1
topk := 10
roundDecimal := -1
params := getSearchParams(IndexFaissIvfFlat, distance.L2)
searchReq := constructSearchRequest("", collectionName, expr,
floatVecField, schemapb.DataType_FloatVector, outputField, distance.L2, params, nq, dim, topk, roundDecimal)
searchResult, err := cluster.proxy.Search(context.Background(), searchReq)
if searchResult.GetStatus().GetErrorCode() != commonpb.ErrorCode_Success {
log.Warn("searchResult fail reason", zap.String("reason", searchResult.GetStatus().GetReason()))
}
assert.NoError(t, err)
assert.Equal(t, commonpb.ErrorCode_Success, searchResult.GetStatus().GetErrorCode())
log.Info("TestHelloMilvus succeed", zap.Any("result", searchResult.Results),
zap.Any("result num", len(searchResult.Results.FieldsData)))
for _, data := range searchResult.Results.FieldsData {
log.Info("output field", zap.Any("outputfield", data.String()))
}
checkFunc(searchResult)
}
func newJSONData(fieldName string, rowNum int) *schemapb.FieldData {
jsonData := make([][]byte, 0, rowNum)
for i := 0; i < rowNum; i++ {
data := map[string]interface{}{
"A": i,
"B": rowNum - i,
"C": []int{i, rowNum - i},
"D": fmt.Sprintf("name-%d", i),
"E": map[string]interface{}{
"F": i,
"G": i + 10,
},
}
if i%2 == 0 {
data = map[string]interface{}{
"B": rowNum - i,
"C": []int{i, rowNum - i},
"D": fmt.Sprintf("name-%d", i),
"E": map[string]interface{}{
"F": i,
"G": i + 10,
},
}
}
if i == 100 {
data = nil
}
jsonBytes, err := json.MarshalIndent(data, "", " ")
if err != nil {
return nil
}
jsonData = append(jsonData, jsonBytes)
}
return &schemapb.FieldData{
Type: schemapb.DataType_JSON,
FieldName: fieldName,
Field: &schemapb.FieldData_Scalars{
Scalars: &schemapb.ScalarField{
Data: &schemapb.ScalarField_JsonData{
JsonData: &schemapb.JSONArray{
Data: jsonData,
},
},
},
},
}
}
func doSearchWithInvalidExpr(cluster *MiniCluster, collectionName string, outputField []string, expr string, dim int, t *testing.T) {
nq := 1
topk := 10
roundDecimal := -1
params := getSearchParams(IndexFaissIvfFlat, distance.L2)
searchReq := constructSearchRequest("", collectionName, expr,
floatVecField, schemapb.DataType_FloatVector, outputField, distance.L2, params, nq, dim, topk, roundDecimal)
searchResult, err := cluster.proxy.Search(context.Background(), searchReq)
if searchResult.GetStatus().GetErrorCode() != commonpb.ErrorCode_Success {
log.Warn("searchResult fail reason", zap.String("reason", searchResult.GetStatus().GetReason()))
}
assert.NoError(t, err)
assert.NotEqual(t, commonpb.ErrorCode_Success, searchResult.GetStatus().GetErrorCode())
}