mirror of https://github.com/milvus-io/milvus.git
Replace plan parser with antlr (#17090)
Signed-off-by: dragondriver <jiquan.long@zilliz.com>pull/17134/head
parent
dcfe472586
commit
276ba69819
|
@ -16,8 +16,8 @@ expr:
|
|||
| expr op = (SHL | SHR) expr # Shift
|
||||
| expr op = (IN | NIN) ('[' expr (',' expr)* ','? ']') # Term
|
||||
| expr op = (IN | NIN) EmptyTerm # EmptyTerm
|
||||
| expr op1 = (LT | LE) expr op2 = (LT | LE) expr # Range
|
||||
| expr op1 = (GT | GE) expr op2 = (GT | GE) expr # ReverseRange
|
||||
| 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
|
||||
|
|
|
@ -83,4 +83,4 @@ expr
|
|||
|
||||
|
||||
atn:
|
||||
[3, 24715, 42794, 33075, 47597, 16764, 15335, 30598, 22884, 3, 39, 91, 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, 5, 2, 17, 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, 3, 2, 3, 2, 7, 2, 73, 10, 2, 12, 2, 14, 2, 76, 11, 2, 3, 2, 5, 2, 79, 10, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 7, 2, 86, 10, 2, 12, 2, 14, 2, 89, 11, 2, 3, 2, 2, 3, 2, 3, 2, 2, 11, 4, 2, 15, 16, 28, 29, 3, 2, 17, 19, 3, 2, 15, 16, 3, 2, 21, 22, 3, 2, 8, 9, 3, 2, 10, 11, 3, 2, 8, 11, 3, 2, 12, 13, 3, 2, 30, 31, 2, 113, 2, 16, 3, 2, 2, 2, 4, 5, 8, 2, 1, 2, 5, 17, 7, 34, 2, 2, 6, 17, 7, 35, 2, 2, 7, 17, 7, 33, 2, 2, 8, 17, 7, 37, 2, 2, 9, 17, 7, 36, 2, 2, 10, 11, 7, 3, 2, 2, 11, 12, 5, 2, 2, 2, 12, 13, 7, 4, 2, 2, 13, 17, 3, 2, 2, 2, 14, 15, 9, 2, 2, 2, 15, 17, 5, 2, 2, 17, 16, 4, 3, 2, 2, 2, 16, 6, 3, 2, 2, 2, 16, 7, 3, 2, 2, 2, 16, 8, 3, 2, 2, 2, 16, 9, 3, 2, 2, 2, 16, 10, 3, 2, 2, 2, 16, 14, 3, 2, 2, 2, 17, 87, 3, 2, 2, 2, 18, 19, 12, 18, 2, 2, 19, 20, 7, 20, 2, 2, 20, 86, 5, 2, 2, 19, 21, 22, 12, 16, 2, 2, 22, 23, 9, 3, 2, 2, 23, 86, 5, 2, 2, 17, 24, 25, 12, 15, 2, 2, 25, 26, 9, 4, 2, 2, 26, 86, 5, 2, 2, 16, 27, 28, 12, 14, 2, 2, 28, 29, 9, 5, 2, 2, 29, 86, 5, 2, 2, 15, 30, 31, 12, 11, 2, 2, 31, 32, 9, 6, 2, 2, 32, 33, 5, 2, 2, 2, 33, 34, 9, 6, 2, 2, 34, 35, 5, 2, 2, 12, 35, 86, 3, 2, 2, 2, 36, 37, 12, 10, 2, 2, 37, 38, 9, 7, 2, 2, 38, 39, 5, 2, 2, 2, 39, 40, 9, 7, 2, 2, 40, 41, 5, 2, 2, 11, 41, 86, 3, 2, 2, 2, 42, 43, 12, 9, 2, 2, 43, 44, 9, 8, 2, 2, 44, 86, 5, 2, 2, 10, 45, 46, 12, 8, 2, 2, 46, 47, 9, 9, 2, 2, 47, 86, 5, 2, 2, 9, 48, 49, 12, 7, 2, 2, 49, 50, 7, 23, 2, 2, 50, 86, 5, 2, 2, 8, 51, 52, 12, 6, 2, 2, 52, 53, 7, 25, 2, 2, 53, 86, 5, 2, 2, 7, 54, 55, 12, 5, 2, 2, 55, 56, 7, 24, 2, 2, 56, 86, 5, 2, 2, 6, 57, 58, 12, 4, 2, 2, 58, 59, 7, 26, 2, 2, 59, 86, 5, 2, 2, 5, 60, 61, 12, 3, 2, 2, 61, 62, 7, 27, 2, 2, 62, 86, 5, 2, 2, 4, 63, 64, 12, 19, 2, 2, 64, 65, 7, 14, 2, 2, 65, 86, 7, 37, 2, 2, 66, 67, 12, 13, 2, 2, 67, 68, 9, 10, 2, 2, 68, 69, 7, 5, 2, 2, 69, 74, 5, 2, 2, 2, 70, 71, 7, 6, 2, 2, 71, 73, 5, 2, 2, 2, 72, 70, 3, 2, 2, 2, 73, 76, 3, 2, 2, 2, 74, 72, 3, 2, 2, 2, 74, 75, 3, 2, 2, 2, 75, 78, 3, 2, 2, 2, 76, 74, 3, 2, 2, 2, 77, 79, 7, 6, 2, 2, 78, 77, 3, 2, 2, 2, 78, 79, 3, 2, 2, 2, 79, 80, 3, 2, 2, 2, 80, 81, 7, 7, 2, 2, 81, 86, 3, 2, 2, 2, 82, 83, 12, 12, 2, 2, 83, 84, 9, 10, 2, 2, 84, 86, 7, 32, 2, 2, 85, 18, 3, 2, 2, 2, 85, 21, 3, 2, 2, 2, 85, 24, 3, 2, 2, 2, 85, 27, 3, 2, 2, 2, 85, 30, 3, 2, 2, 2, 85, 36, 3, 2, 2, 2, 85, 42, 3, 2, 2, 2, 85, 45, 3, 2, 2, 2, 85, 48, 3, 2, 2, 2, 85, 51, 3, 2, 2, 2, 85, 54, 3, 2, 2, 2, 85, 57, 3, 2, 2, 2, 85, 60, 3, 2, 2, 2, 85, 63, 3, 2, 2, 2, 85, 66, 3, 2, 2, 2, 85, 82, 3, 2, 2, 2, 86, 89, 3, 2, 2, 2, 87, 85, 3, 2, 2, 2, 87, 88, 3, 2, 2, 2, 88, 3, 3, 2, 2, 2, 89, 87, 3, 2, 2, 2, 7, 16, 74, 78, 85, 87]
|
||||
[3, 24715, 42794, 33075, 47597, 16764, 15335, 30598, 22884, 3, 39, 89, 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, 5, 2, 17, 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, 71, 10, 2, 12, 2, 14, 2, 74, 11, 2, 3, 2, 5, 2, 77, 10, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 7, 2, 84, 10, 2, 12, 2, 14, 2, 87, 11, 2, 3, 2, 2, 3, 2, 3, 2, 2, 11, 4, 2, 15, 16, 28, 29, 3, 2, 17, 19, 3, 2, 15, 16, 3, 2, 21, 22, 3, 2, 8, 9, 3, 2, 10, 11, 3, 2, 8, 11, 3, 2, 12, 13, 3, 2, 30, 31, 2, 111, 2, 16, 3, 2, 2, 2, 4, 5, 8, 2, 1, 2, 5, 17, 7, 34, 2, 2, 6, 17, 7, 35, 2, 2, 7, 17, 7, 33, 2, 2, 8, 17, 7, 37, 2, 2, 9, 17, 7, 36, 2, 2, 10, 11, 7, 3, 2, 2, 11, 12, 5, 2, 2, 2, 12, 13, 7, 4, 2, 2, 13, 17, 3, 2, 2, 2, 14, 15, 9, 2, 2, 2, 15, 17, 5, 2, 2, 17, 16, 4, 3, 2, 2, 2, 16, 6, 3, 2, 2, 2, 16, 7, 3, 2, 2, 2, 16, 8, 3, 2, 2, 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]
|
|
@ -15,49 +15,48 @@ var _ = reflect.Copy
|
|||
var _ = strconv.Itoa
|
||||
|
||||
var parserATN = []uint16{
|
||||
3, 24715, 42794, 33075, 47597, 16764, 15335, 30598, 22884, 3, 39, 91, 4,
|
||||
3, 24715, 42794, 33075, 47597, 16764, 15335, 30598, 22884, 3, 39, 89, 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, 5, 2, 17, 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, 3, 2, 3, 2, 7, 2, 73,
|
||||
10, 2, 12, 2, 14, 2, 76, 11, 2, 3, 2, 5, 2, 79, 10, 2, 3, 2, 3, 2, 3, 2,
|
||||
3, 2, 3, 2, 7, 2, 86, 10, 2, 12, 2, 14, 2, 89, 11, 2, 3, 2, 2, 3, 2, 3,
|
||||
2, 2, 11, 4, 2, 15, 16, 28, 29, 3, 2, 17, 19, 3, 2, 15, 16, 3, 2, 21, 22,
|
||||
3, 2, 8, 9, 3, 2, 10, 11, 3, 2, 8, 11, 3, 2, 12, 13, 3, 2, 30, 31, 2, 113,
|
||||
2, 16, 3, 2, 2, 2, 4, 5, 8, 2, 1, 2, 5, 17, 7, 34, 2, 2, 6, 17, 7, 35,
|
||||
2, 2, 7, 17, 7, 33, 2, 2, 8, 17, 7, 37, 2, 2, 9, 17, 7, 36, 2, 2, 10, 11,
|
||||
7, 3, 2, 2, 11, 12, 5, 2, 2, 2, 12, 13, 7, 4, 2, 2, 13, 17, 3, 2, 2, 2,
|
||||
14, 15, 9, 2, 2, 2, 15, 17, 5, 2, 2, 17, 16, 4, 3, 2, 2, 2, 16, 6, 3, 2,
|
||||
2, 2, 16, 7, 3, 2, 2, 2, 16, 8, 3, 2, 2, 2, 16, 9, 3, 2, 2, 2, 16, 10,
|
||||
3, 2, 2, 2, 16, 14, 3, 2, 2, 2, 17, 87, 3, 2, 2, 2, 18, 19, 12, 18, 2,
|
||||
2, 19, 20, 7, 20, 2, 2, 20, 86, 5, 2, 2, 19, 21, 22, 12, 16, 2, 2, 22,
|
||||
23, 9, 3, 2, 2, 23, 86, 5, 2, 2, 17, 24, 25, 12, 15, 2, 2, 25, 26, 9, 4,
|
||||
2, 2, 26, 86, 5, 2, 2, 16, 27, 28, 12, 14, 2, 2, 28, 29, 9, 5, 2, 2, 29,
|
||||
86, 5, 2, 2, 15, 30, 31, 12, 11, 2, 2, 31, 32, 9, 6, 2, 2, 32, 33, 5, 2,
|
||||
2, 2, 33, 34, 9, 6, 2, 2, 34, 35, 5, 2, 2, 12, 35, 86, 3, 2, 2, 2, 36,
|
||||
37, 12, 10, 2, 2, 37, 38, 9, 7, 2, 2, 38, 39, 5, 2, 2, 2, 39, 40, 9, 7,
|
||||
2, 2, 40, 41, 5, 2, 2, 11, 41, 86, 3, 2, 2, 2, 42, 43, 12, 9, 2, 2, 43,
|
||||
44, 9, 8, 2, 2, 44, 86, 5, 2, 2, 10, 45, 46, 12, 8, 2, 2, 46, 47, 9, 9,
|
||||
2, 2, 47, 86, 5, 2, 2, 9, 48, 49, 12, 7, 2, 2, 49, 50, 7, 23, 2, 2, 50,
|
||||
86, 5, 2, 2, 8, 51, 52, 12, 6, 2, 2, 52, 53, 7, 25, 2, 2, 53, 86, 5, 2,
|
||||
2, 7, 54, 55, 12, 5, 2, 2, 55, 56, 7, 24, 2, 2, 56, 86, 5, 2, 2, 6, 57,
|
||||
58, 12, 4, 2, 2, 58, 59, 7, 26, 2, 2, 59, 86, 5, 2, 2, 5, 60, 61, 12, 3,
|
||||
2, 2, 61, 62, 7, 27, 2, 2, 62, 86, 5, 2, 2, 4, 63, 64, 12, 19, 2, 2, 64,
|
||||
65, 7, 14, 2, 2, 65, 86, 7, 37, 2, 2, 66, 67, 12, 13, 2, 2, 67, 68, 9,
|
||||
10, 2, 2, 68, 69, 7, 5, 2, 2, 69, 74, 5, 2, 2, 2, 70, 71, 7, 6, 2, 2, 71,
|
||||
73, 5, 2, 2, 2, 72, 70, 3, 2, 2, 2, 73, 76, 3, 2, 2, 2, 74, 72, 3, 2, 2,
|
||||
2, 74, 75, 3, 2, 2, 2, 75, 78, 3, 2, 2, 2, 76, 74, 3, 2, 2, 2, 77, 79,
|
||||
7, 6, 2, 2, 78, 77, 3, 2, 2, 2, 78, 79, 3, 2, 2, 2, 79, 80, 3, 2, 2, 2,
|
||||
80, 81, 7, 7, 2, 2, 81, 86, 3, 2, 2, 2, 82, 83, 12, 12, 2, 2, 83, 84, 9,
|
||||
10, 2, 2, 84, 86, 7, 32, 2, 2, 85, 18, 3, 2, 2, 2, 85, 21, 3, 2, 2, 2,
|
||||
85, 24, 3, 2, 2, 2, 85, 27, 3, 2, 2, 2, 85, 30, 3, 2, 2, 2, 85, 36, 3,
|
||||
2, 2, 2, 85, 42, 3, 2, 2, 2, 85, 45, 3, 2, 2, 2, 85, 48, 3, 2, 2, 2, 85,
|
||||
51, 3, 2, 2, 2, 85, 54, 3, 2, 2, 2, 85, 57, 3, 2, 2, 2, 85, 60, 3, 2, 2,
|
||||
2, 85, 63, 3, 2, 2, 2, 85, 66, 3, 2, 2, 2, 85, 82, 3, 2, 2, 2, 86, 89,
|
||||
3, 2, 2, 2, 87, 85, 3, 2, 2, 2, 87, 88, 3, 2, 2, 2, 88, 3, 3, 2, 2, 2,
|
||||
89, 87, 3, 2, 2, 2, 7, 16, 74, 78, 85, 87,
|
||||
2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 7, 2, 71, 10, 2, 12,
|
||||
2, 14, 2, 74, 11, 2, 3, 2, 5, 2, 77, 10, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3,
|
||||
2, 7, 2, 84, 10, 2, 12, 2, 14, 2, 87, 11, 2, 3, 2, 2, 3, 2, 3, 2, 2, 11,
|
||||
4, 2, 15, 16, 28, 29, 3, 2, 17, 19, 3, 2, 15, 16, 3, 2, 21, 22, 3, 2, 8,
|
||||
9, 3, 2, 10, 11, 3, 2, 8, 11, 3, 2, 12, 13, 3, 2, 30, 31, 2, 111, 2, 16,
|
||||
3, 2, 2, 2, 4, 5, 8, 2, 1, 2, 5, 17, 7, 34, 2, 2, 6, 17, 7, 35, 2, 2, 7,
|
||||
17, 7, 33, 2, 2, 8, 17, 7, 37, 2, 2, 9, 17, 7, 36, 2, 2, 10, 11, 7, 3,
|
||||
2, 2, 11, 12, 5, 2, 2, 2, 12, 13, 7, 4, 2, 2, 13, 17, 3, 2, 2, 2, 14, 15,
|
||||
9, 2, 2, 2, 15, 17, 5, 2, 2, 17, 16, 4, 3, 2, 2, 2, 16, 6, 3, 2, 2, 2,
|
||||
16, 7, 3, 2, 2, 2, 16, 8, 3, 2, 2, 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,
|
||||
}
|
||||
var literalNames = []string{
|
||||
"", "'('", "')'", "'['", "','", "']'", "'<'", "'<='", "'>'", "'>='", "'=='",
|
||||
|
@ -315,6 +314,10 @@ func (s *ReverseRangeContext) Expr(i int) IExprContext {
|
|||
return t.(IExprContext)
|
||||
}
|
||||
|
||||
func (s *ReverseRangeContext) Identifier() antlr.TerminalNode {
|
||||
return s.GetToken(PlanParserIdentifier, 0)
|
||||
}
|
||||
|
||||
func (s *ReverseRangeContext) AllGT() []antlr.TerminalNode {
|
||||
return s.GetTokens(PlanParserGT)
|
||||
}
|
||||
|
@ -749,6 +752,10 @@ func (s *RangeContext) Expr(i int) IExprContext {
|
|||
return t.(IExprContext)
|
||||
}
|
||||
|
||||
func (s *RangeContext) Identifier() antlr.TerminalNode {
|
||||
return s.GetToken(PlanParserIdentifier, 0)
|
||||
}
|
||||
|
||||
func (s *RangeContext) AllLT() []antlr.TerminalNode {
|
||||
return s.GetTokens(PlanParserLT)
|
||||
}
|
||||
|
@ -1569,7 +1576,7 @@ func (p *PlanParser) expr(_p int) (localctx IExprContext) {
|
|||
panic(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil))
|
||||
}
|
||||
p.GetParserRuleContext().SetStop(p.GetTokenStream().LT(-1))
|
||||
p.SetState(85)
|
||||
p.SetState(83)
|
||||
p.GetErrorHandler().Sync(p)
|
||||
_alt = p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 4, p.GetParserRuleContext())
|
||||
|
||||
|
@ -1579,7 +1586,7 @@ func (p *PlanParser) expr(_p int) (localctx IExprContext) {
|
|||
p.TriggerExitRuleEvent()
|
||||
}
|
||||
_prevctx = localctx
|
||||
p.SetState(83)
|
||||
p.SetState(81)
|
||||
p.GetErrorHandler().Sync(p)
|
||||
switch p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 3, p.GetParserRuleContext()) {
|
||||
case 1:
|
||||
|
@ -1720,7 +1727,7 @@ func (p *PlanParser) expr(_p int) (localctx IExprContext) {
|
|||
}
|
||||
{
|
||||
p.SetState(30)
|
||||
p.expr(0)
|
||||
p.Match(PlanParserIdentifier)
|
||||
}
|
||||
{
|
||||
p.SetState(31)
|
||||
|
@ -1748,13 +1755,13 @@ func (p *PlanParser) expr(_p int) (localctx IExprContext) {
|
|||
case 6:
|
||||
localctx = NewReverseRangeContext(p, NewExprContext(p, _parentctx, _parentState))
|
||||
p.PushNewRecursionContext(localctx, _startState, PlanParserRULE_expr)
|
||||
p.SetState(34)
|
||||
p.SetState(33)
|
||||
|
||||
if !(p.Precpred(p.GetParserRuleContext(), 8)) {
|
||||
panic(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 8)", ""))
|
||||
}
|
||||
{
|
||||
p.SetState(35)
|
||||
p.SetState(34)
|
||||
|
||||
var _lt = p.GetTokenStream().LT(1)
|
||||
|
||||
|
@ -1772,11 +1779,11 @@ func (p *PlanParser) expr(_p int) (localctx IExprContext) {
|
|||
}
|
||||
}
|
||||
{
|
||||
p.SetState(36)
|
||||
p.expr(0)
|
||||
p.SetState(35)
|
||||
p.Match(PlanParserIdentifier)
|
||||
}
|
||||
{
|
||||
p.SetState(37)
|
||||
p.SetState(36)
|
||||
|
||||
var _lt = p.GetTokenStream().LT(1)
|
||||
|
||||
|
@ -1794,20 +1801,20 @@ func (p *PlanParser) expr(_p int) (localctx IExprContext) {
|
|||
}
|
||||
}
|
||||
{
|
||||
p.SetState(38)
|
||||
p.SetState(37)
|
||||
p.expr(9)
|
||||
}
|
||||
|
||||
case 7:
|
||||
localctx = NewRelationalContext(p, NewExprContext(p, _parentctx, _parentState))
|
||||
p.PushNewRecursionContext(localctx, _startState, PlanParserRULE_expr)
|
||||
p.SetState(40)
|
||||
p.SetState(38)
|
||||
|
||||
if !(p.Precpred(p.GetParserRuleContext(), 7)) {
|
||||
panic(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 7)", ""))
|
||||
}
|
||||
{
|
||||
p.SetState(41)
|
||||
p.SetState(39)
|
||||
|
||||
var _lt = p.GetTokenStream().LT(1)
|
||||
|
||||
|
@ -1825,20 +1832,20 @@ func (p *PlanParser) expr(_p int) (localctx IExprContext) {
|
|||
}
|
||||
}
|
||||
{
|
||||
p.SetState(42)
|
||||
p.SetState(40)
|
||||
p.expr(8)
|
||||
}
|
||||
|
||||
case 8:
|
||||
localctx = NewEqualityContext(p, NewExprContext(p, _parentctx, _parentState))
|
||||
p.PushNewRecursionContext(localctx, _startState, PlanParserRULE_expr)
|
||||
p.SetState(43)
|
||||
p.SetState(41)
|
||||
|
||||
if !(p.Precpred(p.GetParserRuleContext(), 6)) {
|
||||
panic(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 6)", ""))
|
||||
}
|
||||
{
|
||||
p.SetState(44)
|
||||
p.SetState(42)
|
||||
|
||||
var _lt = p.GetTokenStream().LT(1)
|
||||
|
||||
|
@ -1856,122 +1863,122 @@ func (p *PlanParser) expr(_p int) (localctx IExprContext) {
|
|||
}
|
||||
}
|
||||
{
|
||||
p.SetState(45)
|
||||
p.SetState(43)
|
||||
p.expr(7)
|
||||
}
|
||||
|
||||
case 9:
|
||||
localctx = NewBitAndContext(p, NewExprContext(p, _parentctx, _parentState))
|
||||
p.PushNewRecursionContext(localctx, _startState, PlanParserRULE_expr)
|
||||
p.SetState(46)
|
||||
p.SetState(44)
|
||||
|
||||
if !(p.Precpred(p.GetParserRuleContext(), 5)) {
|
||||
panic(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 5)", ""))
|
||||
}
|
||||
{
|
||||
p.SetState(47)
|
||||
p.SetState(45)
|
||||
p.Match(PlanParserBAND)
|
||||
}
|
||||
{
|
||||
p.SetState(48)
|
||||
p.SetState(46)
|
||||
p.expr(6)
|
||||
}
|
||||
|
||||
case 10:
|
||||
localctx = NewBitXorContext(p, NewExprContext(p, _parentctx, _parentState))
|
||||
p.PushNewRecursionContext(localctx, _startState, PlanParserRULE_expr)
|
||||
p.SetState(49)
|
||||
p.SetState(47)
|
||||
|
||||
if !(p.Precpred(p.GetParserRuleContext(), 4)) {
|
||||
panic(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 4)", ""))
|
||||
}
|
||||
{
|
||||
p.SetState(50)
|
||||
p.SetState(48)
|
||||
p.Match(PlanParserBXOR)
|
||||
}
|
||||
{
|
||||
p.SetState(51)
|
||||
p.SetState(49)
|
||||
p.expr(5)
|
||||
}
|
||||
|
||||
case 11:
|
||||
localctx = NewBitOrContext(p, NewExprContext(p, _parentctx, _parentState))
|
||||
p.PushNewRecursionContext(localctx, _startState, PlanParserRULE_expr)
|
||||
p.SetState(52)
|
||||
p.SetState(50)
|
||||
|
||||
if !(p.Precpred(p.GetParserRuleContext(), 3)) {
|
||||
panic(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 3)", ""))
|
||||
}
|
||||
{
|
||||
p.SetState(53)
|
||||
p.SetState(51)
|
||||
p.Match(PlanParserBOR)
|
||||
}
|
||||
{
|
||||
p.SetState(54)
|
||||
p.SetState(52)
|
||||
p.expr(4)
|
||||
}
|
||||
|
||||
case 12:
|
||||
localctx = NewLogicalAndContext(p, NewExprContext(p, _parentctx, _parentState))
|
||||
p.PushNewRecursionContext(localctx, _startState, PlanParserRULE_expr)
|
||||
p.SetState(55)
|
||||
p.SetState(53)
|
||||
|
||||
if !(p.Precpred(p.GetParserRuleContext(), 2)) {
|
||||
panic(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 2)", ""))
|
||||
}
|
||||
{
|
||||
p.SetState(56)
|
||||
p.SetState(54)
|
||||
p.Match(PlanParserAND)
|
||||
}
|
||||
{
|
||||
p.SetState(57)
|
||||
p.SetState(55)
|
||||
p.expr(3)
|
||||
}
|
||||
|
||||
case 13:
|
||||
localctx = NewLogicalOrContext(p, NewExprContext(p, _parentctx, _parentState))
|
||||
p.PushNewRecursionContext(localctx, _startState, PlanParserRULE_expr)
|
||||
p.SetState(58)
|
||||
p.SetState(56)
|
||||
|
||||
if !(p.Precpred(p.GetParserRuleContext(), 1)) {
|
||||
panic(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 1)", ""))
|
||||
}
|
||||
{
|
||||
p.SetState(59)
|
||||
p.SetState(57)
|
||||
p.Match(PlanParserOR)
|
||||
}
|
||||
{
|
||||
p.SetState(60)
|
||||
p.SetState(58)
|
||||
p.expr(2)
|
||||
}
|
||||
|
||||
case 14:
|
||||
localctx = NewLikeContext(p, NewExprContext(p, _parentctx, _parentState))
|
||||
p.PushNewRecursionContext(localctx, _startState, PlanParserRULE_expr)
|
||||
p.SetState(61)
|
||||
p.SetState(59)
|
||||
|
||||
if !(p.Precpred(p.GetParserRuleContext(), 17)) {
|
||||
panic(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 17)", ""))
|
||||
}
|
||||
{
|
||||
p.SetState(62)
|
||||
p.SetState(60)
|
||||
p.Match(PlanParserLIKE)
|
||||
}
|
||||
{
|
||||
p.SetState(63)
|
||||
p.SetState(61)
|
||||
p.Match(PlanParserStringLiteral)
|
||||
}
|
||||
|
||||
case 15:
|
||||
localctx = NewTermContext(p, NewExprContext(p, _parentctx, _parentState))
|
||||
p.PushNewRecursionContext(localctx, _startState, PlanParserRULE_expr)
|
||||
p.SetState(64)
|
||||
p.SetState(62)
|
||||
|
||||
if !(p.Precpred(p.GetParserRuleContext(), 11)) {
|
||||
panic(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 11)", ""))
|
||||
}
|
||||
{
|
||||
p.SetState(65)
|
||||
p.SetState(63)
|
||||
|
||||
var _lt = p.GetTokenStream().LT(1)
|
||||
|
||||
|
@ -1990,59 +1997,59 @@ func (p *PlanParser) expr(_p int) (localctx IExprContext) {
|
|||
}
|
||||
|
||||
{
|
||||
p.SetState(66)
|
||||
p.SetState(64)
|
||||
p.Match(PlanParserT__2)
|
||||
}
|
||||
{
|
||||
p.SetState(67)
|
||||
p.SetState(65)
|
||||
p.expr(0)
|
||||
}
|
||||
p.SetState(72)
|
||||
p.SetState(70)
|
||||
p.GetErrorHandler().Sync(p)
|
||||
_alt = p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 1, p.GetParserRuleContext())
|
||||
|
||||
for _alt != 2 && _alt != antlr.ATNInvalidAltNumber {
|
||||
if _alt == 1 {
|
||||
{
|
||||
p.SetState(68)
|
||||
p.SetState(66)
|
||||
p.Match(PlanParserT__3)
|
||||
}
|
||||
{
|
||||
p.SetState(69)
|
||||
p.SetState(67)
|
||||
p.expr(0)
|
||||
}
|
||||
|
||||
}
|
||||
p.SetState(74)
|
||||
p.SetState(72)
|
||||
p.GetErrorHandler().Sync(p)
|
||||
_alt = p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 1, p.GetParserRuleContext())
|
||||
}
|
||||
p.SetState(76)
|
||||
p.SetState(74)
|
||||
p.GetErrorHandler().Sync(p)
|
||||
_la = p.GetTokenStream().LA(1)
|
||||
|
||||
if _la == PlanParserT__3 {
|
||||
{
|
||||
p.SetState(75)
|
||||
p.SetState(73)
|
||||
p.Match(PlanParserT__3)
|
||||
}
|
||||
|
||||
}
|
||||
{
|
||||
p.SetState(78)
|
||||
p.SetState(76)
|
||||
p.Match(PlanParserT__4)
|
||||
}
|
||||
|
||||
case 16:
|
||||
localctx = NewEmptyTermContext(p, NewExprContext(p, _parentctx, _parentState))
|
||||
p.PushNewRecursionContext(localctx, _startState, PlanParserRULE_expr)
|
||||
p.SetState(80)
|
||||
p.SetState(78)
|
||||
|
||||
if !(p.Precpred(p.GetParserRuleContext(), 10)) {
|
||||
panic(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 10)", ""))
|
||||
}
|
||||
{
|
||||
p.SetState(81)
|
||||
p.SetState(79)
|
||||
|
||||
var _lt = p.GetTokenStream().LT(1)
|
||||
|
||||
|
@ -2060,14 +2067,14 @@ func (p *PlanParser) expr(_p int) (localctx IExprContext) {
|
|||
}
|
||||
}
|
||||
{
|
||||
p.SetState(82)
|
||||
p.SetState(80)
|
||||
p.Match(PlanParserEmptyTerm)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
p.SetState(87)
|
||||
p.SetState(85)
|
||||
p.GetErrorHandler().Sync(p)
|
||||
_alt = p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 4, p.GetParserRuleContext())
|
||||
}
|
||||
|
|
|
@ -24,12 +24,10 @@ func (v *ParserVisitor) VisitParens(ctx *parser.ParensContext) interface{} {
|
|||
return ctx.Expr().Accept(v)
|
||||
}
|
||||
|
||||
// VisitIdentifier translates expr to column plan.
|
||||
func (v *ParserVisitor) VisitIdentifier(ctx *parser.IdentifierContext) interface{} {
|
||||
fieldName := ctx.Identifier().GetText()
|
||||
field, err := v.schema.GetFieldFromName(fieldName)
|
||||
func (v *ParserVisitor) translateIdentifier(identifier string) (*ExprWithType, error) {
|
||||
field, err := v.schema.GetFieldFromName(identifier)
|
||||
if err != nil {
|
||||
return err
|
||||
return nil, err
|
||||
}
|
||||
return &ExprWithType{
|
||||
expr: &planpb.Expr{
|
||||
|
@ -45,7 +43,17 @@ func (v *ParserVisitor) VisitIdentifier(ctx *parser.IdentifierContext) interface
|
|||
},
|
||||
},
|
||||
dataType: field.DataType,
|
||||
}, nil
|
||||
}
|
||||
|
||||
// VisitIdentifier translates expr to column plan.
|
||||
func (v *ParserVisitor) VisitIdentifier(ctx *parser.IdentifierContext) interface{} {
|
||||
identifier := ctx.Identifier().GetText()
|
||||
expr, err := v.translateIdentifier(identifier)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return expr
|
||||
}
|
||||
|
||||
// VisitBoolean translates expr to GenericValue.
|
||||
|
@ -525,24 +533,19 @@ func (v *ParserVisitor) VisitEmptyTerm(ctx *parser.EmptyTermContext) interface{}
|
|||
|
||||
// VisitRange translates expr to range plan.
|
||||
func (v *ParserVisitor) VisitRange(ctx *parser.RangeContext) interface{} {
|
||||
child := ctx.Expr(1).Accept(v)
|
||||
if err := getError(child); err != nil {
|
||||
identifier := ctx.Identifier().GetText()
|
||||
childExpr, err := v.translateIdentifier(identifier)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
childValue := getGenericValue(child)
|
||||
if childValue != nil {
|
||||
return fmt.Errorf("'range' can only be used on non-const expression")
|
||||
}
|
||||
|
||||
childExpr := getExpr(child)
|
||||
columnInfo := toColumnInfo(childExpr)
|
||||
if columnInfo == nil {
|
||||
return fmt.Errorf("range operations are only supported on single fields now, got: %s", ctx.Expr(1).GetText())
|
||||
}
|
||||
|
||||
lower := ctx.Expr(0).Accept(v)
|
||||
upper := ctx.Expr(2).Accept(v)
|
||||
upper := ctx.Expr(1).Accept(v)
|
||||
if err := getError(lower); err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -614,23 +617,18 @@ func (v *ParserVisitor) VisitRange(ctx *parser.RangeContext) interface{} {
|
|||
|
||||
// VisitReverseRange parses the expression like "1 > a > 0".
|
||||
func (v *ParserVisitor) VisitReverseRange(ctx *parser.ReverseRangeContext) interface{} {
|
||||
child := ctx.Expr(1).Accept(v)
|
||||
if err := getError(child); err != nil {
|
||||
identifier := ctx.Identifier().GetText()
|
||||
childExpr, err := v.translateIdentifier(identifier)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
childValue := getGenericValue(child)
|
||||
if childValue != nil {
|
||||
return fmt.Errorf("'range' can only be used on non-const expression")
|
||||
}
|
||||
|
||||
childExpr := getExpr(child)
|
||||
columnInfo := toColumnInfo(childExpr)
|
||||
if columnInfo == nil {
|
||||
return fmt.Errorf("range operations are only supported on single fields now, got: %s", ctx.Expr(1).GetText())
|
||||
}
|
||||
|
||||
lower := ctx.Expr(2).Accept(v)
|
||||
lower := ctx.Expr(1).Accept(v)
|
||||
upper := ctx.Expr(0).Accept(v)
|
||||
if err := getError(lower); err != nil {
|
||||
return err
|
||||
|
|
|
@ -316,6 +316,8 @@ func TestExpr_Combinations(t *testing.T) {
|
|||
`not (Int8Field + 1 == 2)`,
|
||||
`(Int16Field - 3 == 4) and (Int32Field * 5 != 6)`,
|
||||
`(Int64Field / 7 != 8) or (Int64Field % 10 == 9)`,
|
||||
`Int64Field > 0 && VarCharField > "0"`,
|
||||
`Int64Field < 0 && VarCharField < "0"`,
|
||||
}
|
||||
for _, exprStr := range exprStrs {
|
||||
assertValidExpr(t, helper, exprStr)
|
||||
|
|
|
@ -627,6 +627,7 @@ func Test_CheckIdentical(t *testing.T) {
|
|||
"200+300 < Int64Field <= 500+500",
|
||||
"Int32Field != Int64Field",
|
||||
"Int64Field not in []",
|
||||
`Int64Field >= 0 && VarCharField >= "0"`,
|
||||
largeIntTermExpr,
|
||||
largeFloatTermExpr,
|
||||
}
|
||||
|
|
|
@ -9,6 +9,8 @@ import (
|
|||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/milvus-io/milvus/internal/parser/planparserv2"
|
||||
|
||||
"github.com/golang/protobuf/proto"
|
||||
"go.uber.org/zap"
|
||||
"golang.org/x/sync/errgroup"
|
||||
|
@ -157,7 +159,7 @@ func (t *queryTask) PreExecute(ctx context.Context) error {
|
|||
return fmt.Errorf("query expression is empty")
|
||||
}
|
||||
|
||||
plan, err := createExprPlan(schema, t.request.Expr)
|
||||
plan, err := planparserv2.CreateRetrievePlan(schema, t.request.Expr)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -9,6 +9,8 @@ import (
|
|||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/milvus-io/milvus/internal/parser/planparserv2"
|
||||
|
||||
"github.com/golang/protobuf/proto"
|
||||
"go.uber.org/zap"
|
||||
"golang.org/x/sync/errgroup"
|
||||
|
@ -185,7 +187,7 @@ func (t *searchTask) PreExecute(ctx context.Context) error {
|
|||
zap.String("anns field", annsField),
|
||||
zap.Any("query info", queryInfo))
|
||||
|
||||
plan, err := createQueryPlan(t.schema, t.request.Dsl, annsField, queryInfo)
|
||||
plan, err := planparserv2.CreateSearchPlan(t.schema, t.request.Dsl, annsField, queryInfo)
|
||||
if err != nil {
|
||||
log.Debug("failed to create query plan",
|
||||
zap.Error(err),
|
||||
|
|
|
@ -1142,6 +1142,7 @@ class TestDeleteString(TestcaseBase):
|
|||
|
||||
# delete half and flush
|
||||
expr = f'{ct.default_string_field_name} in {insert_res.primary_keys[:ct.default_nb // 2]}'
|
||||
expr = expr.replace("'", "\"")
|
||||
del_res, _ = collection_w.delete(expr)
|
||||
assert collection_w.num_entities == ct.default_nb
|
||||
|
||||
|
@ -1189,10 +1190,10 @@ class TestDeleteString(TestcaseBase):
|
|||
# insert id tmp_nb and delete id 0 and tmp_nb
|
||||
df_new = cf.gen_default_dataframe_data(nb=1, start=tmp_nb)
|
||||
collection_w.insert(df_new)
|
||||
collection_w.delete(expr=f'{ct.default_string_field_name} in {["tmp_nb"]}')
|
||||
collection_w.delete(expr=f'{ct.default_string_field_name} in ["tmp_nb"]')
|
||||
|
||||
# query with id 0 and tmp_nb
|
||||
collection_w.query(expr=f'{ct.default_string_field_name} in {["0", "tmp_nb"]}',
|
||||
collection_w.query(expr=f'{ct.default_string_field_name} in ["0", "tmp_nb"]',
|
||||
check_task=CheckTasks.check_query_empty)
|
||||
|
||||
@pytest.mark.tags(CaseLabel.L1)
|
||||
|
@ -1212,6 +1213,7 @@ class TestDeleteString(TestcaseBase):
|
|||
assert "0" in search_res[0].ids
|
||||
|
||||
expr = f'{ct.default_string_field_name} in {ids[:ct.default_nb // 2]}'
|
||||
expr = expr.replace("'", "\"")
|
||||
collection_w.delete(expr)
|
||||
search_res_2, _ = collection_w.search([entity[0][ct.default_float_vec_field_name]],
|
||||
ct.default_float_vec_field_name,
|
||||
|
@ -1233,7 +1235,7 @@ class TestDeleteString(TestcaseBase):
|
|||
"""
|
||||
# init collection with nb default data
|
||||
collection_w = self.init_collection_general(prefix, nb=tmp_nb, insert_data=True, primary_field=ct.default_string_field_name)[0]
|
||||
expr = f'{ct.default_string_field_name} in {["0", "0", "0"]}'
|
||||
expr = f'{ct.default_string_field_name} in ["0", "0", "0"]'
|
||||
del_res, _ = collection_w.delete(expr)
|
||||
assert del_res.delete_count == 3
|
||||
collection_w.num_entities
|
||||
|
@ -1433,11 +1435,13 @@ class TestDeleteString(TestcaseBase):
|
|||
|
||||
for del_id in ids:
|
||||
expr = f'{ct.default_string_field_name} in {[del_id]}'
|
||||
expr = expr.replace("'", "\"")
|
||||
res = collection_w.delete(expr)[0]
|
||||
assert res.delete_count == 1
|
||||
|
||||
# query with all ids
|
||||
expr = f'{ct.default_string_field_name} in {ids}'
|
||||
expr = expr.replace("'", "\"")
|
||||
collection_w.query(expr, check_task=CheckTasks.check_query_empty)
|
||||
|
||||
@pytest.mark.tags(CaseLabel.L2)
|
||||
|
@ -1453,12 +1457,14 @@ class TestDeleteString(TestcaseBase):
|
|||
batch = 10
|
||||
for i in range(tmp_nb // batch):
|
||||
expr = f'{ct.default_string_field_name} in {ids[i * batch: (i + 1) * batch]}'
|
||||
expr = expr.replace("'", "\"")
|
||||
res, _ = collection_w.delete(expr)
|
||||
assert res.delete_count == batch
|
||||
assert collection_w.num_entities == tmp_nb
|
||||
|
||||
# query with all ids
|
||||
expr = f'{ct.default_string_field_name} in {ids}'
|
||||
expr = expr.replace("'", "\"")
|
||||
collection_w.query(expr, check_task=CheckTasks.check_query_empty)
|
||||
|
||||
@pytest.mark.tags(CaseLabel.L2)
|
||||
|
@ -1531,8 +1537,8 @@ class TestDeleteString(TestcaseBase):
|
|||
collection_w.query(default_string_expr, check_task=CheckTasks.check_query_empty)
|
||||
|
||||
# delete id 1 and query id 0 and 1
|
||||
collection_w.delete(expr=f'{ct.default_string_field_name} in {["1"]}')
|
||||
collection_w.query(expr=f'{ct.default_string_field_name} in {["0", "1"]}',
|
||||
collection_w.delete(expr=f'{ct.default_string_field_name} in ["1"]')
|
||||
collection_w.query(expr=f'{ct.default_string_field_name} in ["0", "1"]',
|
||||
check_task=CheckTasks.check_query_empty)
|
||||
|
||||
@pytest.mark.tags(CaseLabel.L1)
|
||||
|
@ -1589,6 +1595,7 @@ class TestDeleteString(TestcaseBase):
|
|||
ct.default_search_params, ct.default_limit)
|
||||
|
||||
expr = f'{ct.default_string_field_name} in {insert_res.primary_keys[:tmp_nb // 2]}'
|
||||
expr = expr.replace("'", "\"")
|
||||
delete_res, _ = collection_w.delete(expr)
|
||||
|
||||
res_travel, _ = collection_w.search(df[ct.default_float_vec_field_name][:1].to_list(),
|
||||
|
@ -1620,6 +1627,7 @@ class TestDeleteString(TestcaseBase):
|
|||
# delete even numbers
|
||||
ids = [str(i) for i in range(0, tmp_nb * multi, 2)]
|
||||
expr = f'{ct.default_string_field_name} in {ids}'
|
||||
expr = expr.replace("'", "\"")
|
||||
collection_w.delete(expr)
|
||||
|
||||
collection_w.load()
|
||||
|
|
|
@ -1284,7 +1284,7 @@ class TestqueryString(TestcaseBase):
|
|||
"""
|
||||
collection_w, vectors = self.init_collection_general(prefix, insert_data=True, primary_field=ct.default_string_field_name)[0:2]
|
||||
res = vectors[0].iloc[:1, :3].to_dict('records')
|
||||
expression = "varchar startsWith \"0\""
|
||||
expression = 'varchar like "0%"'
|
||||
output_fields = [default_int_field_name, default_float_field_name, default_string_field_name]
|
||||
collection_w.query(expression, output_fields=output_fields,
|
||||
check_task=CheckTasks.check_query_results, check_items={exp_res: res})
|
||||
|
|
|
@ -27,7 +27,7 @@ default_search_exp = "int64 >= 0"
|
|||
default_search_string_exp = "varchar >= \"0\""
|
||||
default_search_mix_exp = "int64 >= 0 && varchar >= \"0\""
|
||||
default_invaild_string_exp = "varchar >= 0"
|
||||
perfix_expr = "varchar startsWith \"0\""
|
||||
perfix_expr = 'varchar like "0%"'
|
||||
default_search_field = ct.default_float_vec_field_name
|
||||
default_search_params = ct.default_search_params
|
||||
default_int64_field_name = ct.default_int64_field_name
|
||||
|
|
Loading…
Reference in New Issue