fix: [2.5] exists should have a higher priority (#40865)

issue: #40837 

master pr: #40864

Signed-off-by: Cai Zhang <cai.zhang@zilliz.com>
This commit is contained in:
cai.zhang 2025-03-26 20:02:34 +08:00 committed by GitHub
parent e8970e8bf4
commit 534b628278
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 233 additions and 231 deletions

View File

@ -11,6 +11,7 @@ expr:
| '(' expr ')' # Parens
| '[' expr (',' expr)* ','? ']' # Array
| EmptyArray # EmptyArray
| EXISTS expr # Exists
| expr LIKE StringLiteral # Like
| TEXTMATCH'('Identifier',' StringLiteral')' # TextMatch
| expr POW expr # Power
@ -35,8 +36,7 @@ expr:
| expr AND expr # LogicalAnd
| expr OR expr # LogicalOr
| Identifier ISNULL # IsNull
| Identifier ISNOTNULL # IsNotNull
| EXISTS expr # Exists;
| Identifier ISNOTNULL # IsNotNull;
// typeName: ty = (BOOL | INT8 | INT16 | INT32 | INT64 | FLOAT | DOUBLE);

File diff suppressed because one or more lines are too long

View File

@ -58,71 +58,71 @@ func planParserInit() {
0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
0, 1, 0, 5, 0, 70, 8, 0, 10, 0, 12, 0, 73, 9, 0, 1, 0, 3, 0, 76, 8, 0,
3, 0, 78, 8, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 3, 0, 87, 8,
0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
0, 1, 0, 1, 0, 3, 0, 103, 8, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 5, 0, 141, 8, 0, 10, 0, 12, 0, 144, 9,
0, 1, 0, 0, 1, 0, 1, 0, 0, 13, 1, 0, 46, 47, 2, 0, 17, 18, 32, 33, 2, 0,
36, 36, 39, 39, 2, 0, 37, 37, 40, 40, 2, 0, 38, 38, 41, 41, 2, 0, 46, 46,
49, 49, 1, 0, 19, 21, 1, 0, 17, 18, 1, 0, 23, 24, 1, 0, 8, 9, 1, 0, 10,
11, 1, 0, 8, 11, 1, 0, 12, 13, 184, 0, 86, 1, 0, 0, 0, 2, 3, 6, 0, -1,
0, 3, 87, 5, 44, 0, 0, 4, 87, 5, 45, 0, 0, 5, 87, 5, 43, 0, 0, 6, 87, 5,
48, 0, 0, 7, 87, 7, 0, 0, 0, 8, 87, 5, 49, 0, 0, 9, 10, 5, 6, 0, 0, 10,
11, 5, 46, 0, 0, 11, 87, 5, 7, 0, 0, 12, 13, 5, 1, 0, 0, 13, 14, 3, 0,
0, 0, 14, 15, 5, 2, 0, 0, 15, 87, 1, 0, 0, 0, 16, 17, 5, 3, 0, 0, 17, 22,
3, 0, 0, 0, 18, 19, 5, 4, 0, 0, 19, 21, 3, 0, 0, 0, 20, 18, 1, 0, 0, 0,
21, 24, 1, 0, 0, 0, 22, 20, 1, 0, 0, 0, 22, 23, 1, 0, 0, 0, 23, 26, 1,
0, 0, 0, 24, 22, 1, 0, 0, 0, 25, 27, 5, 4, 0, 0, 26, 25, 1, 0, 0, 0, 26,
27, 1, 0, 0, 0, 27, 28, 1, 0, 0, 0, 28, 29, 5, 5, 0, 0, 29, 87, 1, 0, 0,
0, 30, 87, 5, 35, 0, 0, 31, 32, 5, 16, 0, 0, 32, 33, 5, 1, 0, 0, 33, 34,
5, 46, 0, 0, 34, 35, 5, 4, 0, 0, 35, 36, 5, 48, 0, 0, 36, 87, 5, 2, 0,
0, 37, 38, 7, 1, 0, 0, 38, 87, 3, 0, 0, 22, 39, 40, 7, 2, 0, 0, 40, 41,
5, 1, 0, 0, 41, 42, 3, 0, 0, 0, 42, 43, 5, 4, 0, 0, 43, 44, 3, 0, 0, 0,
44, 45, 5, 2, 0, 0, 45, 87, 1, 0, 0, 0, 46, 47, 7, 3, 0, 0, 47, 48, 5,
1, 0, 0, 48, 49, 3, 0, 0, 0, 49, 50, 5, 4, 0, 0, 50, 51, 3, 0, 0, 0, 51,
52, 5, 2, 0, 0, 52, 87, 1, 0, 0, 0, 53, 54, 7, 4, 0, 0, 54, 55, 5, 1, 0,
0, 55, 56, 3, 0, 0, 0, 56, 57, 5, 4, 0, 0, 57, 58, 3, 0, 0, 0, 58, 59,
5, 2, 0, 0, 59, 87, 1, 0, 0, 0, 60, 61, 5, 42, 0, 0, 61, 62, 5, 1, 0, 0,
62, 63, 7, 5, 0, 0, 63, 87, 5, 2, 0, 0, 64, 65, 5, 46, 0, 0, 65, 77, 5,
1, 0, 0, 66, 71, 3, 0, 0, 0, 67, 68, 5, 4, 0, 0, 68, 70, 3, 0, 0, 0, 69,
67, 1, 0, 0, 0, 70, 73, 1, 0, 0, 0, 71, 69, 1, 0, 0, 0, 71, 72, 1, 0, 0,
0, 72, 75, 1, 0, 0, 0, 73, 71, 1, 0, 0, 0, 74, 76, 5, 4, 0, 0, 75, 74,
1, 0, 0, 0, 75, 76, 1, 0, 0, 0, 76, 78, 1, 0, 0, 0, 77, 66, 1, 0, 0, 0,
77, 78, 1, 0, 0, 0, 78, 79, 1, 0, 0, 0, 79, 87, 5, 2, 0, 0, 80, 81, 5,
46, 0, 0, 81, 87, 5, 30, 0, 0, 82, 83, 5, 46, 0, 0, 83, 87, 5, 31, 0, 0,
84, 85, 5, 15, 0, 0, 85, 87, 3, 0, 0, 1, 86, 2, 1, 0, 0, 0, 86, 4, 1, 0,
0, 0, 86, 5, 1, 0, 0, 0, 86, 6, 1, 0, 0, 0, 86, 7, 1, 0, 0, 0, 86, 8, 1,
0, 0, 0, 86, 9, 1, 0, 0, 0, 86, 12, 1, 0, 0, 0, 86, 16, 1, 0, 0, 0, 86,
30, 1, 0, 0, 0, 86, 31, 1, 0, 0, 0, 86, 37, 1, 0, 0, 0, 86, 39, 1, 0, 0,
0, 86, 46, 1, 0, 0, 0, 86, 53, 1, 0, 0, 0, 86, 60, 1, 0, 0, 0, 86, 64,
1, 0, 0, 0, 86, 80, 1, 0, 0, 0, 86, 82, 1, 0, 0, 0, 86, 84, 1, 0, 0, 0,
87, 142, 1, 0, 0, 0, 88, 89, 10, 23, 0, 0, 89, 90, 5, 22, 0, 0, 90, 141,
3, 0, 0, 24, 91, 92, 10, 21, 0, 0, 92, 93, 7, 6, 0, 0, 93, 141, 3, 0, 0,
22, 94, 95, 10, 20, 0, 0, 95, 96, 7, 7, 0, 0, 96, 141, 3, 0, 0, 21, 97,
98, 10, 19, 0, 0, 98, 99, 7, 8, 0, 0, 99, 141, 3, 0, 0, 20, 100, 102, 10,
18, 0, 0, 101, 103, 5, 33, 0, 0, 102, 101, 1, 0, 0, 0, 102, 103, 1, 0,
0, 0, 103, 104, 1, 0, 0, 0, 104, 105, 5, 34, 0, 0, 105, 141, 3, 0, 0, 19,
106, 107, 10, 12, 0, 0, 107, 108, 7, 9, 0, 0, 108, 109, 7, 5, 0, 0, 109,
110, 7, 9, 0, 0, 110, 141, 3, 0, 0, 13, 111, 112, 10, 11, 0, 0, 112, 113,
7, 10, 0, 0, 113, 114, 7, 5, 0, 0, 114, 115, 7, 10, 0, 0, 115, 141, 3,
0, 0, 12, 116, 117, 10, 10, 0, 0, 117, 118, 7, 11, 0, 0, 118, 141, 3, 0,
0, 11, 119, 120, 10, 9, 0, 0, 120, 121, 7, 12, 0, 0, 121, 141, 3, 0, 0,
10, 122, 123, 10, 8, 0, 0, 123, 124, 5, 25, 0, 0, 124, 141, 3, 0, 0, 9,
125, 126, 10, 7, 0, 0, 126, 127, 5, 27, 0, 0, 127, 141, 3, 0, 0, 8, 128,
129, 10, 6, 0, 0, 129, 130, 5, 26, 0, 0, 130, 141, 3, 0, 0, 7, 131, 132,
10, 5, 0, 0, 132, 133, 5, 28, 0, 0, 133, 141, 3, 0, 0, 6, 134, 135, 10,
4, 0, 0, 135, 136, 5, 29, 0, 0, 136, 141, 3, 0, 0, 5, 137, 138, 10, 25,
0, 0, 138, 139, 5, 14, 0, 0, 139, 141, 5, 48, 0, 0, 140, 88, 1, 0, 0, 0,
140, 91, 1, 0, 0, 0, 140, 94, 1, 0, 0, 0, 140, 97, 1, 0, 0, 0, 140, 100,
1, 0, 0, 0, 140, 106, 1, 0, 0, 0, 140, 111, 1, 0, 0, 0, 140, 116, 1, 0,
0, 0, 140, 119, 1, 0, 0, 0, 140, 122, 1, 0, 0, 0, 140, 125, 1, 0, 0, 0,
140, 128, 1, 0, 0, 0, 140, 131, 1, 0, 0, 0, 140, 134, 1, 0, 0, 0, 140,
137, 1, 0, 0, 0, 141, 144, 1, 0, 0, 0, 142, 140, 1, 0, 0, 0, 142, 143,
1, 0, 0, 0, 143, 1, 1, 0, 0, 0, 144, 142, 1, 0, 0, 0, 9, 22, 26, 71, 75,
77, 86, 102, 140, 142,
0, 1, 0, 1, 0, 1, 0, 5, 0, 72, 8, 0, 10, 0, 12, 0, 75, 9, 0, 1, 0, 3, 0,
78, 8, 0, 3, 0, 80, 8, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 3, 0, 87, 8, 0,
1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,
1, 0, 1, 0, 3, 0, 103, 8, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,
1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,
1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,
1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 5, 0, 141, 8, 0, 10, 0, 12, 0, 144, 9, 0,
1, 0, 0, 1, 0, 1, 0, 0, 13, 1, 0, 46, 47, 2, 0, 17, 18, 32, 33, 2, 0, 36,
36, 39, 39, 2, 0, 37, 37, 40, 40, 2, 0, 38, 38, 41, 41, 2, 0, 46, 46, 49,
49, 1, 0, 19, 21, 1, 0, 17, 18, 1, 0, 23, 24, 1, 0, 8, 9, 1, 0, 10, 11,
1, 0, 8, 11, 1, 0, 12, 13, 184, 0, 86, 1, 0, 0, 0, 2, 3, 6, 0, -1, 0, 3,
87, 5, 44, 0, 0, 4, 87, 5, 45, 0, 0, 5, 87, 5, 43, 0, 0, 6, 87, 5, 48,
0, 0, 7, 87, 7, 0, 0, 0, 8, 87, 5, 49, 0, 0, 9, 10, 5, 6, 0, 0, 10, 11,
5, 46, 0, 0, 11, 87, 5, 7, 0, 0, 12, 13, 5, 1, 0, 0, 13, 14, 3, 0, 0, 0,
14, 15, 5, 2, 0, 0, 15, 87, 1, 0, 0, 0, 16, 17, 5, 3, 0, 0, 17, 22, 3,
0, 0, 0, 18, 19, 5, 4, 0, 0, 19, 21, 3, 0, 0, 0, 20, 18, 1, 0, 0, 0, 21,
24, 1, 0, 0, 0, 22, 20, 1, 0, 0, 0, 22, 23, 1, 0, 0, 0, 23, 26, 1, 0, 0,
0, 24, 22, 1, 0, 0, 0, 25, 27, 5, 4, 0, 0, 26, 25, 1, 0, 0, 0, 26, 27,
1, 0, 0, 0, 27, 28, 1, 0, 0, 0, 28, 29, 5, 5, 0, 0, 29, 87, 1, 0, 0, 0,
30, 87, 5, 35, 0, 0, 31, 32, 5, 15, 0, 0, 32, 87, 3, 0, 0, 25, 33, 34,
5, 16, 0, 0, 34, 35, 5, 1, 0, 0, 35, 36, 5, 46, 0, 0, 36, 37, 5, 4, 0,
0, 37, 38, 5, 48, 0, 0, 38, 87, 5, 2, 0, 0, 39, 40, 7, 1, 0, 0, 40, 87,
3, 0, 0, 21, 41, 42, 7, 2, 0, 0, 42, 43, 5, 1, 0, 0, 43, 44, 3, 0, 0, 0,
44, 45, 5, 4, 0, 0, 45, 46, 3, 0, 0, 0, 46, 47, 5, 2, 0, 0, 47, 87, 1,
0, 0, 0, 48, 49, 7, 3, 0, 0, 49, 50, 5, 1, 0, 0, 50, 51, 3, 0, 0, 0, 51,
52, 5, 4, 0, 0, 52, 53, 3, 0, 0, 0, 53, 54, 5, 2, 0, 0, 54, 87, 1, 0, 0,
0, 55, 56, 7, 4, 0, 0, 56, 57, 5, 1, 0, 0, 57, 58, 3, 0, 0, 0, 58, 59,
5, 4, 0, 0, 59, 60, 3, 0, 0, 0, 60, 61, 5, 2, 0, 0, 61, 87, 1, 0, 0, 0,
62, 63, 5, 42, 0, 0, 63, 64, 5, 1, 0, 0, 64, 65, 7, 5, 0, 0, 65, 87, 5,
2, 0, 0, 66, 67, 5, 46, 0, 0, 67, 79, 5, 1, 0, 0, 68, 73, 3, 0, 0, 0, 69,
70, 5, 4, 0, 0, 70, 72, 3, 0, 0, 0, 71, 69, 1, 0, 0, 0, 72, 75, 1, 0, 0,
0, 73, 71, 1, 0, 0, 0, 73, 74, 1, 0, 0, 0, 74, 77, 1, 0, 0, 0, 75, 73,
1, 0, 0, 0, 76, 78, 5, 4, 0, 0, 77, 76, 1, 0, 0, 0, 77, 78, 1, 0, 0, 0,
78, 80, 1, 0, 0, 0, 79, 68, 1, 0, 0, 0, 79, 80, 1, 0, 0, 0, 80, 81, 1,
0, 0, 0, 81, 87, 5, 2, 0, 0, 82, 83, 5, 46, 0, 0, 83, 87, 5, 30, 0, 0,
84, 85, 5, 46, 0, 0, 85, 87, 5, 31, 0, 0, 86, 2, 1, 0, 0, 0, 86, 4, 1,
0, 0, 0, 86, 5, 1, 0, 0, 0, 86, 6, 1, 0, 0, 0, 86, 7, 1, 0, 0, 0, 86, 8,
1, 0, 0, 0, 86, 9, 1, 0, 0, 0, 86, 12, 1, 0, 0, 0, 86, 16, 1, 0, 0, 0,
86, 30, 1, 0, 0, 0, 86, 31, 1, 0, 0, 0, 86, 33, 1, 0, 0, 0, 86, 39, 1,
0, 0, 0, 86, 41, 1, 0, 0, 0, 86, 48, 1, 0, 0, 0, 86, 55, 1, 0, 0, 0, 86,
62, 1, 0, 0, 0, 86, 66, 1, 0, 0, 0, 86, 82, 1, 0, 0, 0, 86, 84, 1, 0, 0,
0, 87, 142, 1, 0, 0, 0, 88, 89, 10, 22, 0, 0, 89, 90, 5, 22, 0, 0, 90,
141, 3, 0, 0, 23, 91, 92, 10, 20, 0, 0, 92, 93, 7, 6, 0, 0, 93, 141, 3,
0, 0, 21, 94, 95, 10, 19, 0, 0, 95, 96, 7, 7, 0, 0, 96, 141, 3, 0, 0, 20,
97, 98, 10, 18, 0, 0, 98, 99, 7, 8, 0, 0, 99, 141, 3, 0, 0, 19, 100, 102,
10, 17, 0, 0, 101, 103, 5, 33, 0, 0, 102, 101, 1, 0, 0, 0, 102, 103, 1,
0, 0, 0, 103, 104, 1, 0, 0, 0, 104, 105, 5, 34, 0, 0, 105, 141, 3, 0, 0,
18, 106, 107, 10, 11, 0, 0, 107, 108, 7, 9, 0, 0, 108, 109, 7, 5, 0, 0,
109, 110, 7, 9, 0, 0, 110, 141, 3, 0, 0, 12, 111, 112, 10, 10, 0, 0, 112,
113, 7, 10, 0, 0, 113, 114, 7, 5, 0, 0, 114, 115, 7, 10, 0, 0, 115, 141,
3, 0, 0, 11, 116, 117, 10, 9, 0, 0, 117, 118, 7, 11, 0, 0, 118, 141, 3,
0, 0, 10, 119, 120, 10, 8, 0, 0, 120, 121, 7, 12, 0, 0, 121, 141, 3, 0,
0, 9, 122, 123, 10, 7, 0, 0, 123, 124, 5, 25, 0, 0, 124, 141, 3, 0, 0,
8, 125, 126, 10, 6, 0, 0, 126, 127, 5, 27, 0, 0, 127, 141, 3, 0, 0, 7,
128, 129, 10, 5, 0, 0, 129, 130, 5, 26, 0, 0, 130, 141, 3, 0, 0, 6, 131,
132, 10, 4, 0, 0, 132, 133, 5, 28, 0, 0, 133, 141, 3, 0, 0, 5, 134, 135,
10, 3, 0, 0, 135, 136, 5, 29, 0, 0, 136, 141, 3, 0, 0, 4, 137, 138, 10,
24, 0, 0, 138, 139, 5, 14, 0, 0, 139, 141, 5, 48, 0, 0, 140, 88, 1, 0,
0, 0, 140, 91, 1, 0, 0, 0, 140, 94, 1, 0, 0, 0, 140, 97, 1, 0, 0, 0, 140,
100, 1, 0, 0, 0, 140, 106, 1, 0, 0, 0, 140, 111, 1, 0, 0, 0, 140, 116,
1, 0, 0, 0, 140, 119, 1, 0, 0, 0, 140, 122, 1, 0, 0, 0, 140, 125, 1, 0,
0, 0, 140, 128, 1, 0, 0, 0, 140, 131, 1, 0, 0, 0, 140, 134, 1, 0, 0, 0,
140, 137, 1, 0, 0, 0, 141, 144, 1, 0, 0, 0, 142, 140, 1, 0, 0, 0, 142,
143, 1, 0, 0, 0, 143, 1, 1, 0, 0, 0, 144, 142, 1, 0, 0, 0, 9, 22, 26, 73,
77, 79, 86, 102, 140, 142,
}
deserializer := antlr.NewATNDeserializer(nil)
staticData.atn = deserializer.Deserialize(staticData.serializedATN)
@ -2674,12 +2674,12 @@ func (p *PlanParser) expr(_p int) (localctx IExprContext) {
}
case 11:
localctx = NewTextMatchContext(p, localctx)
localctx = NewExistsContext(p, localctx)
p.SetParserRuleContext(localctx)
_prevctx = localctx
{
p.SetState(31)
p.Match(PlanParserTEXTMATCH)
p.Match(PlanParserEXISTS)
if p.HasError() {
// Recognition error - abort rule
goto errorExit
@ -2687,15 +2687,16 @@ func (p *PlanParser) expr(_p int) (localctx IExprContext) {
}
{
p.SetState(32)
p.Match(PlanParserT__0)
if p.HasError() {
// Recognition error - abort rule
goto errorExit
}
p.expr(25)
}
case 12:
localctx = NewTextMatchContext(p, localctx)
p.SetParserRuleContext(localctx)
_prevctx = localctx
{
p.SetState(33)
p.Match(PlanParserIdentifier)
p.Match(PlanParserTEXTMATCH)
if p.HasError() {
// Recognition error - abort rule
goto errorExit
@ -2703,7 +2704,7 @@ func (p *PlanParser) expr(_p int) (localctx IExprContext) {
}
{
p.SetState(34)
p.Match(PlanParserT__3)
p.Match(PlanParserT__0)
if p.HasError() {
// Recognition error - abort rule
goto errorExit
@ -2711,7 +2712,7 @@ func (p *PlanParser) expr(_p int) (localctx IExprContext) {
}
{
p.SetState(35)
p.Match(PlanParserStringLiteral)
p.Match(PlanParserIdentifier)
if p.HasError() {
// Recognition error - abort rule
goto errorExit
@ -2719,6 +2720,22 @@ func (p *PlanParser) expr(_p int) (localctx IExprContext) {
}
{
p.SetState(36)
p.Match(PlanParserT__3)
if p.HasError() {
// Recognition error - abort rule
goto errorExit
}
}
{
p.SetState(37)
p.Match(PlanParserStringLiteral)
if p.HasError() {
// Recognition error - abort rule
goto errorExit
}
}
{
p.SetState(38)
p.Match(PlanParserT__1)
if p.HasError() {
// Recognition error - abort rule
@ -2726,12 +2743,12 @@ func (p *PlanParser) expr(_p int) (localctx IExprContext) {
}
}
case 12:
case 13:
localctx = NewUnaryContext(p, localctx)
p.SetParserRuleContext(localctx)
_prevctx = localctx
{
p.SetState(37)
p.SetState(39)
var _lt = p.GetTokenStream().LT(1)
@ -2749,16 +2766,16 @@ func (p *PlanParser) expr(_p int) (localctx IExprContext) {
}
}
{
p.SetState(38)
p.expr(22)
p.SetState(40)
p.expr(21)
}
case 13:
case 14:
localctx = NewJSONContainsContext(p, localctx)
p.SetParserRuleContext(localctx)
_prevctx = localctx
{
p.SetState(39)
p.SetState(41)
_la = p.GetTokenStream().LA(1)
if !(_la == PlanParserJSONContains || _la == PlanParserArrayContains) {
@ -2768,21 +2785,9 @@ func (p *PlanParser) expr(_p int) (localctx IExprContext) {
p.Consume()
}
}
{
p.SetState(40)
p.Match(PlanParserT__0)
if p.HasError() {
// Recognition error - abort rule
goto errorExit
}
}
{
p.SetState(41)
p.expr(0)
}
{
p.SetState(42)
p.Match(PlanParserT__3)
p.Match(PlanParserT__0)
if p.HasError() {
// Recognition error - abort rule
goto errorExit
@ -2794,6 +2799,18 @@ func (p *PlanParser) expr(_p int) (localctx IExprContext) {
}
{
p.SetState(44)
p.Match(PlanParserT__3)
if p.HasError() {
// Recognition error - abort rule
goto errorExit
}
}
{
p.SetState(45)
p.expr(0)
}
{
p.SetState(46)
p.Match(PlanParserT__1)
if p.HasError() {
// Recognition error - abort rule
@ -2801,12 +2818,12 @@ func (p *PlanParser) expr(_p int) (localctx IExprContext) {
}
}
case 14:
case 15:
localctx = NewJSONContainsAllContext(p, localctx)
p.SetParserRuleContext(localctx)
_prevctx = localctx
{
p.SetState(46)
p.SetState(48)
_la = p.GetTokenStream().LA(1)
if !(_la == PlanParserJSONContainsAll || _la == PlanParserArrayContainsAll) {
@ -2816,21 +2833,9 @@ func (p *PlanParser) expr(_p int) (localctx IExprContext) {
p.Consume()
}
}
{
p.SetState(47)
p.Match(PlanParserT__0)
if p.HasError() {
// Recognition error - abort rule
goto errorExit
}
}
{
p.SetState(48)
p.expr(0)
}
{
p.SetState(49)
p.Match(PlanParserT__3)
p.Match(PlanParserT__0)
if p.HasError() {
// Recognition error - abort rule
goto errorExit
@ -2842,6 +2847,18 @@ func (p *PlanParser) expr(_p int) (localctx IExprContext) {
}
{
p.SetState(51)
p.Match(PlanParserT__3)
if p.HasError() {
// Recognition error - abort rule
goto errorExit
}
}
{
p.SetState(52)
p.expr(0)
}
{
p.SetState(53)
p.Match(PlanParserT__1)
if p.HasError() {
// Recognition error - abort rule
@ -2849,12 +2866,12 @@ func (p *PlanParser) expr(_p int) (localctx IExprContext) {
}
}
case 15:
case 16:
localctx = NewJSONContainsAnyContext(p, localctx)
p.SetParserRuleContext(localctx)
_prevctx = localctx
{
p.SetState(53)
p.SetState(55)
_la = p.GetTokenStream().LA(1)
if !(_la == PlanParserJSONContainsAny || _la == PlanParserArrayContainsAny) {
@ -2864,21 +2881,9 @@ func (p *PlanParser) expr(_p int) (localctx IExprContext) {
p.Consume()
}
}
{
p.SetState(54)
p.Match(PlanParserT__0)
if p.HasError() {
// Recognition error - abort rule
goto errorExit
}
}
{
p.SetState(55)
p.expr(0)
}
{
p.SetState(56)
p.Match(PlanParserT__3)
p.Match(PlanParserT__0)
if p.HasError() {
// Recognition error - abort rule
goto errorExit
@ -2890,6 +2895,18 @@ func (p *PlanParser) expr(_p int) (localctx IExprContext) {
}
{
p.SetState(58)
p.Match(PlanParserT__3)
if p.HasError() {
// Recognition error - abort rule
goto errorExit
}
}
{
p.SetState(59)
p.expr(0)
}
{
p.SetState(60)
p.Match(PlanParserT__1)
if p.HasError() {
// Recognition error - abort rule
@ -2897,12 +2914,12 @@ func (p *PlanParser) expr(_p int) (localctx IExprContext) {
}
}
case 16:
case 17:
localctx = NewArrayLengthContext(p, localctx)
p.SetParserRuleContext(localctx)
_prevctx = localctx
{
p.SetState(60)
p.SetState(62)
p.Match(PlanParserArrayLength)
if p.HasError() {
// Recognition error - abort rule
@ -2910,7 +2927,7 @@ func (p *PlanParser) expr(_p int) (localctx IExprContext) {
}
}
{
p.SetState(61)
p.SetState(63)
p.Match(PlanParserT__0)
if p.HasError() {
// Recognition error - abort rule
@ -2918,7 +2935,7 @@ func (p *PlanParser) expr(_p int) (localctx IExprContext) {
}
}
{
p.SetState(62)
p.SetState(64)
_la = p.GetTokenStream().LA(1)
if !(_la == PlanParserIdentifier || _la == PlanParserJSONIdentifier) {
@ -2929,7 +2946,7 @@ func (p *PlanParser) expr(_p int) (localctx IExprContext) {
}
}
{
p.SetState(63)
p.SetState(65)
p.Match(PlanParserT__1)
if p.HasError() {
// Recognition error - abort rule
@ -2937,12 +2954,12 @@ func (p *PlanParser) expr(_p int) (localctx IExprContext) {
}
}
case 17:
case 18:
localctx = NewCallContext(p, localctx)
p.SetParserRuleContext(localctx)
_prevctx = localctx
{
p.SetState(64)
p.SetState(66)
p.Match(PlanParserIdentifier)
if p.HasError() {
// Recognition error - abort rule
@ -2950,14 +2967,14 @@ func (p *PlanParser) expr(_p int) (localctx IExprContext) {
}
}
{
p.SetState(65)
p.SetState(67)
p.Match(PlanParserT__0)
if p.HasError() {
// Recognition error - abort rule
goto errorExit
}
}
p.SetState(77)
p.SetState(79)
p.GetErrorHandler().Sync(p)
if p.HasError() {
goto errorExit
@ -2966,10 +2983,10 @@ func (p *PlanParser) expr(_p int) (localctx IExprContext) {
if (int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&1125878432497738) != 0 {
{
p.SetState(66)
p.SetState(68)
p.expr(0)
}
p.SetState(71)
p.SetState(73)
p.GetErrorHandler().Sync(p)
if p.HasError() {
goto errorExit
@ -2981,7 +2998,7 @@ func (p *PlanParser) expr(_p int) (localctx IExprContext) {
for _alt != 2 && _alt != antlr.ATNInvalidAltNumber {
if _alt == 1 {
{
p.SetState(67)
p.SetState(69)
p.Match(PlanParserT__3)
if p.HasError() {
// Recognition error - abort rule
@ -2989,12 +3006,12 @@ func (p *PlanParser) expr(_p int) (localctx IExprContext) {
}
}
{
p.SetState(68)
p.SetState(70)
p.expr(0)
}
}
p.SetState(73)
p.SetState(75)
p.GetErrorHandler().Sync(p)
if p.HasError() {
goto errorExit
@ -3004,7 +3021,7 @@ func (p *PlanParser) expr(_p int) (localctx IExprContext) {
goto errorExit
}
}
p.SetState(75)
p.SetState(77)
p.GetErrorHandler().Sync(p)
if p.HasError() {
goto errorExit
@ -3013,7 +3030,7 @@ func (p *PlanParser) expr(_p int) (localctx IExprContext) {
if _la == PlanParserT__3 {
{
p.SetState(74)
p.SetState(76)
p.Match(PlanParserT__3)
if p.HasError() {
// Recognition error - abort rule
@ -3025,7 +3042,7 @@ func (p *PlanParser) expr(_p int) (localctx IExprContext) {
}
{
p.SetState(79)
p.SetState(81)
p.Match(PlanParserT__1)
if p.HasError() {
// Recognition error - abort rule
@ -3033,29 +3050,8 @@ func (p *PlanParser) expr(_p int) (localctx IExprContext) {
}
}
case 18:
localctx = NewIsNullContext(p, localctx)
p.SetParserRuleContext(localctx)
_prevctx = localctx
{
p.SetState(80)
p.Match(PlanParserIdentifier)
if p.HasError() {
// Recognition error - abort rule
goto errorExit
}
}
{
p.SetState(81)
p.Match(PlanParserISNULL)
if p.HasError() {
// Recognition error - abort rule
goto errorExit
}
}
case 19:
localctx = NewIsNotNullContext(p, localctx)
localctx = NewIsNullContext(p, localctx)
p.SetParserRuleContext(localctx)
_prevctx = localctx
{
@ -3068,7 +3064,7 @@ func (p *PlanParser) expr(_p int) (localctx IExprContext) {
}
{
p.SetState(83)
p.Match(PlanParserISNOTNULL)
p.Match(PlanParserISNULL)
if p.HasError() {
// Recognition error - abort rule
goto errorExit
@ -3076,12 +3072,12 @@ func (p *PlanParser) expr(_p int) (localctx IExprContext) {
}
case 20:
localctx = NewExistsContext(p, localctx)
localctx = NewIsNotNullContext(p, localctx)
p.SetParserRuleContext(localctx)
_prevctx = localctx
{
p.SetState(84)
p.Match(PlanParserEXISTS)
p.Match(PlanParserIdentifier)
if p.HasError() {
// Recognition error - abort rule
goto errorExit
@ -3089,7 +3085,11 @@ func (p *PlanParser) expr(_p int) (localctx IExprContext) {
}
{
p.SetState(85)
p.expr(1)
p.Match(PlanParserISNOTNULL)
if p.HasError() {
// Recognition error - abort rule
goto errorExit
}
}
case antlr.ATNInvalidAltNumber:
@ -3123,8 +3123,8 @@ func (p *PlanParser) expr(_p int) (localctx IExprContext) {
p.PushNewRecursionContext(localctx, _startState, PlanParserRULE_expr)
p.SetState(88)
if !(p.Precpred(p.GetParserRuleContext(), 23)) {
p.SetError(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 23)", ""))
if !(p.Precpred(p.GetParserRuleContext(), 22)) {
p.SetError(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 22)", ""))
goto errorExit
}
{
@ -3137,7 +3137,7 @@ func (p *PlanParser) expr(_p int) (localctx IExprContext) {
}
{
p.SetState(90)
p.expr(24)
p.expr(23)
}
case 2:
@ -3145,8 +3145,8 @@ func (p *PlanParser) expr(_p int) (localctx IExprContext) {
p.PushNewRecursionContext(localctx, _startState, PlanParserRULE_expr)
p.SetState(91)
if !(p.Precpred(p.GetParserRuleContext(), 21)) {
p.SetError(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 21)", ""))
if !(p.Precpred(p.GetParserRuleContext(), 20)) {
p.SetError(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 20)", ""))
goto errorExit
}
{
@ -3169,7 +3169,7 @@ func (p *PlanParser) expr(_p int) (localctx IExprContext) {
}
{
p.SetState(93)
p.expr(22)
p.expr(21)
}
case 3:
@ -3177,8 +3177,8 @@ func (p *PlanParser) expr(_p int) (localctx IExprContext) {
p.PushNewRecursionContext(localctx, _startState, PlanParserRULE_expr)
p.SetState(94)
if !(p.Precpred(p.GetParserRuleContext(), 20)) {
p.SetError(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 20)", ""))
if !(p.Precpred(p.GetParserRuleContext(), 19)) {
p.SetError(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 19)", ""))
goto errorExit
}
{
@ -3201,7 +3201,7 @@ func (p *PlanParser) expr(_p int) (localctx IExprContext) {
}
{
p.SetState(96)
p.expr(21)
p.expr(20)
}
case 4:
@ -3209,8 +3209,8 @@ func (p *PlanParser) expr(_p int) (localctx IExprContext) {
p.PushNewRecursionContext(localctx, _startState, PlanParserRULE_expr)
p.SetState(97)
if !(p.Precpred(p.GetParserRuleContext(), 19)) {
p.SetError(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 19)", ""))
if !(p.Precpred(p.GetParserRuleContext(), 18)) {
p.SetError(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 18)", ""))
goto errorExit
}
{
@ -3233,7 +3233,7 @@ func (p *PlanParser) expr(_p int) (localctx IExprContext) {
}
{
p.SetState(99)
p.expr(20)
p.expr(19)
}
case 5:
@ -3241,8 +3241,8 @@ func (p *PlanParser) expr(_p int) (localctx IExprContext) {
p.PushNewRecursionContext(localctx, _startState, PlanParserRULE_expr)
p.SetState(100)
if !(p.Precpred(p.GetParserRuleContext(), 18)) {
p.SetError(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 18)", ""))
if !(p.Precpred(p.GetParserRuleContext(), 17)) {
p.SetError(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 17)", ""))
goto errorExit
}
p.SetState(102)
@ -3276,7 +3276,7 @@ func (p *PlanParser) expr(_p int) (localctx IExprContext) {
}
{
p.SetState(105)
p.expr(19)
p.expr(18)
}
case 6:
@ -3284,8 +3284,8 @@ func (p *PlanParser) expr(_p int) (localctx IExprContext) {
p.PushNewRecursionContext(localctx, _startState, PlanParserRULE_expr)
p.SetState(106)
if !(p.Precpred(p.GetParserRuleContext(), 12)) {
p.SetError(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 12)", ""))
if !(p.Precpred(p.GetParserRuleContext(), 11)) {
p.SetError(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 11)", ""))
goto errorExit
}
{
@ -3337,7 +3337,7 @@ func (p *PlanParser) expr(_p int) (localctx IExprContext) {
}
{
p.SetState(110)
p.expr(13)
p.expr(12)
}
case 7:
@ -3345,8 +3345,8 @@ func (p *PlanParser) expr(_p int) (localctx IExprContext) {
p.PushNewRecursionContext(localctx, _startState, PlanParserRULE_expr)
p.SetState(111)
if !(p.Precpred(p.GetParserRuleContext(), 11)) {
p.SetError(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 11)", ""))
if !(p.Precpred(p.GetParserRuleContext(), 10)) {
p.SetError(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 10)", ""))
goto errorExit
}
{
@ -3398,7 +3398,7 @@ func (p *PlanParser) expr(_p int) (localctx IExprContext) {
}
{
p.SetState(115)
p.expr(12)
p.expr(11)
}
case 8:
@ -3406,8 +3406,8 @@ func (p *PlanParser) expr(_p int) (localctx IExprContext) {
p.PushNewRecursionContext(localctx, _startState, PlanParserRULE_expr)
p.SetState(116)
if !(p.Precpred(p.GetParserRuleContext(), 10)) {
p.SetError(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 10)", ""))
if !(p.Precpred(p.GetParserRuleContext(), 9)) {
p.SetError(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 9)", ""))
goto errorExit
}
{
@ -3430,7 +3430,7 @@ func (p *PlanParser) expr(_p int) (localctx IExprContext) {
}
{
p.SetState(118)
p.expr(11)
p.expr(10)
}
case 9:
@ -3438,8 +3438,8 @@ func (p *PlanParser) expr(_p int) (localctx IExprContext) {
p.PushNewRecursionContext(localctx, _startState, PlanParserRULE_expr)
p.SetState(119)
if !(p.Precpred(p.GetParserRuleContext(), 9)) {
p.SetError(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 9)", ""))
if !(p.Precpred(p.GetParserRuleContext(), 8)) {
p.SetError(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 8)", ""))
goto errorExit
}
{
@ -3462,7 +3462,7 @@ func (p *PlanParser) expr(_p int) (localctx IExprContext) {
}
{
p.SetState(121)
p.expr(10)
p.expr(9)
}
case 10:
@ -3470,8 +3470,8 @@ func (p *PlanParser) expr(_p int) (localctx IExprContext) {
p.PushNewRecursionContext(localctx, _startState, PlanParserRULE_expr)
p.SetState(122)
if !(p.Precpred(p.GetParserRuleContext(), 8)) {
p.SetError(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 8)", ""))
if !(p.Precpred(p.GetParserRuleContext(), 7)) {
p.SetError(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 7)", ""))
goto errorExit
}
{
@ -3484,7 +3484,7 @@ func (p *PlanParser) expr(_p int) (localctx IExprContext) {
}
{
p.SetState(124)
p.expr(9)
p.expr(8)
}
case 11:
@ -3492,8 +3492,8 @@ func (p *PlanParser) expr(_p int) (localctx IExprContext) {
p.PushNewRecursionContext(localctx, _startState, PlanParserRULE_expr)
p.SetState(125)
if !(p.Precpred(p.GetParserRuleContext(), 7)) {
p.SetError(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 7)", ""))
if !(p.Precpred(p.GetParserRuleContext(), 6)) {
p.SetError(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 6)", ""))
goto errorExit
}
{
@ -3506,7 +3506,7 @@ func (p *PlanParser) expr(_p int) (localctx IExprContext) {
}
{
p.SetState(127)
p.expr(8)
p.expr(7)
}
case 12:
@ -3514,8 +3514,8 @@ func (p *PlanParser) expr(_p int) (localctx IExprContext) {
p.PushNewRecursionContext(localctx, _startState, PlanParserRULE_expr)
p.SetState(128)
if !(p.Precpred(p.GetParserRuleContext(), 6)) {
p.SetError(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 6)", ""))
if !(p.Precpred(p.GetParserRuleContext(), 5)) {
p.SetError(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 5)", ""))
goto errorExit
}
{
@ -3528,7 +3528,7 @@ func (p *PlanParser) expr(_p int) (localctx IExprContext) {
}
{
p.SetState(130)
p.expr(7)
p.expr(6)
}
case 13:
@ -3536,8 +3536,8 @@ func (p *PlanParser) expr(_p int) (localctx IExprContext) {
p.PushNewRecursionContext(localctx, _startState, PlanParserRULE_expr)
p.SetState(131)
if !(p.Precpred(p.GetParserRuleContext(), 5)) {
p.SetError(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 5)", ""))
if !(p.Precpred(p.GetParserRuleContext(), 4)) {
p.SetError(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 4)", ""))
goto errorExit
}
{
@ -3550,7 +3550,7 @@ func (p *PlanParser) expr(_p int) (localctx IExprContext) {
}
{
p.SetState(133)
p.expr(6)
p.expr(5)
}
case 14:
@ -3558,8 +3558,8 @@ func (p *PlanParser) expr(_p int) (localctx IExprContext) {
p.PushNewRecursionContext(localctx, _startState, PlanParserRULE_expr)
p.SetState(134)
if !(p.Precpred(p.GetParserRuleContext(), 4)) {
p.SetError(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 4)", ""))
if !(p.Precpred(p.GetParserRuleContext(), 3)) {
p.SetError(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 3)", ""))
goto errorExit
}
{
@ -3572,7 +3572,7 @@ func (p *PlanParser) expr(_p int) (localctx IExprContext) {
}
{
p.SetState(136)
p.expr(5)
p.expr(4)
}
case 15:
@ -3580,8 +3580,8 @@ func (p *PlanParser) expr(_p int) (localctx IExprContext) {
p.PushNewRecursionContext(localctx, _startState, PlanParserRULE_expr)
p.SetState(137)
if !(p.Precpred(p.GetParserRuleContext(), 25)) {
p.SetError(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 25)", ""))
if !(p.Precpred(p.GetParserRuleContext(), 24)) {
p.SetError(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 24)", ""))
goto errorExit
}
{
@ -3647,49 +3647,49 @@ func (p *PlanParser) Sempred(localctx antlr.RuleContext, ruleIndex, predIndex in
func (p *PlanParser) Expr_Sempred(localctx antlr.RuleContext, predIndex int) bool {
switch predIndex {
case 0:
return p.Precpred(p.GetParserRuleContext(), 23)
return p.Precpred(p.GetParserRuleContext(), 22)
case 1:
return p.Precpred(p.GetParserRuleContext(), 21)
case 2:
return p.Precpred(p.GetParserRuleContext(), 20)
case 3:
case 2:
return p.Precpred(p.GetParserRuleContext(), 19)
case 4:
case 3:
return p.Precpred(p.GetParserRuleContext(), 18)
case 5:
return p.Precpred(p.GetParserRuleContext(), 12)
case 4:
return p.Precpred(p.GetParserRuleContext(), 17)
case 6:
case 5:
return p.Precpred(p.GetParserRuleContext(), 11)
case 7:
case 6:
return p.Precpred(p.GetParserRuleContext(), 10)
case 8:
case 7:
return p.Precpred(p.GetParserRuleContext(), 9)
case 9:
case 8:
return p.Precpred(p.GetParserRuleContext(), 8)
case 10:
case 9:
return p.Precpred(p.GetParserRuleContext(), 7)
case 11:
case 10:
return p.Precpred(p.GetParserRuleContext(), 6)
case 12:
case 11:
return p.Precpred(p.GetParserRuleContext(), 5)
case 13:
case 12:
return p.Precpred(p.GetParserRuleContext(), 4)
case 13:
return p.Precpred(p.GetParserRuleContext(), 3)
case 14:
return p.Precpred(p.GetParserRuleContext(), 25)
return p.Precpred(p.GetParserRuleContext(), 24)
default:
panic("No predicate with index: " + fmt.Sprint(predIndex))

View File

@ -873,6 +873,8 @@ func Test_JSONExpr(t *testing.T) {
`100 == $meta["A"] + 6`,
`exists $meta["A"]`,
`exists $meta["A"]["B"]["C"] `,
`exists $meta["A"] || exists JSONField["A"]`,
`exists $meta["A"] && exists JSONField["A"]`,
`A["B"][0] > 100`,
`$meta[0] > 100`,
`A["\"\"B\"\""] > 10`,