milvus/internal/proto/plan.proto
FluorineDog 88f5642603
Add plan proto and support basic boolean expr parser (#5088)
**What type of PR is this?**
- [x] Feature

**What this PR does / why we need it:**
This PR supports boolean expression as DSL.
1. The goal of this PR is to support predicates
    like `A > 3 && not B < 5 or C in [1, 2, 3]`. 
2. Defines `plan.proto`, as Intermediate Representation (IR) 
    used between go and cpp. 
3. Support expr parser, convert predicate expr to IR
    in proxynode, while doing static check there
4. Support IR to AST in cpp, enable the execution
2021-04-29 08:48:06 +00:00

85 lines
1.4 KiB
Protocol Buffer

syntax = "proto3";
package milvus.proto.plan;
option go_package = "github.com/milvus-io/milvus/internal/proto/planpb";
import "schema.proto";
message GenericValue {
oneof val {
bool bool_val = 1;
int64 int64_val = 2;
double float_val = 3;
};
}
message QueryInfo {
int64 topk = 1;
string metric_type = 3;
string search_params = 4;
}
message ColumnInfo {
int64 field_id = 1;
schema.DataType data_type = 2;
}
message RangeExpr {
ColumnInfo column_info = 1;
enum OpType {
Invalid = 0;
GreaterThan = 1;
GreaterEqual = 2;
LessThan = 3;
LessEqual = 4;
Equal = 5;
NotEqual = 6;
};
repeated OpType ops = 2;
repeated GenericValue values = 3;
}
message TermExpr {
ColumnInfo column_info = 1;
repeated GenericValue values = 2;
}
message UnaryExpr {
enum UnaryOp{
Invalid = 0;
Not = 1;
};
UnaryOp op = 1;
Expr child = 2;
}
message BinaryExpr {
enum BinaryOp {
Invalid = 0;
LogicalAnd = 1;
LogicalOr = 2;
}
}
message Expr {
oneof expr {
RangeExpr range_expr = 1;
TermExpr term_expr = 2;
UnaryExpr unary_expr = 3;
BinaryExpr binary_expr = 4;
};
}
message VectorANNS {
bool is_binary = 1;
int64 field_id = 2;
Expr predicates = 3;
QueryInfo query_info = 4;
string placeholder_tag = 5; // always be "$0"
}
message PlanNode {
oneof node {
VectorANNS vector_anns = 1;
}
}