2021-05-21 15:12:32 +00:00
|
|
|
parser grammar Query;
|
|
|
|
|
|
|
|
options {
|
|
|
|
tokenVocab = QueryLexer;
|
|
|
|
}
|
|
|
|
|
2024-02-22 19:29:25 +00:00
|
|
|
policy: UNIQUE? (repStmt | ecStmt)+ cbfStmt? selectStmt* filterStmt* EOF;
|
2021-05-21 15:12:32 +00:00
|
|
|
|
2023-07-13 13:12:47 +00:00
|
|
|
selectFilterExpr: cbfStmt? selectStmt? filterStmt* EOF;
|
|
|
|
|
2024-02-22 19:29:25 +00:00
|
|
|
ecStmt:
|
|
|
|
EC Data = NUMBER1 DOT Parity = NUMBER1 // erasure code configuration
|
|
|
|
(IN Selector = ident)?; // optional selector name
|
|
|
|
|
2021-05-21 15:12:32 +00:00
|
|
|
repStmt:
|
|
|
|
REP Count = NUMBER1 // number of object replicas
|
|
|
|
(IN Selector = ident)?; // optional selector name
|
|
|
|
|
|
|
|
cbfStmt: CBF BackupFactor = NUMBER1; // container backup factor
|
|
|
|
|
|
|
|
selectStmt:
|
2024-09-17 09:15:06 +00:00
|
|
|
SELECT Count = NUMBER1 // number of nodes to select without container backup factor *)
|
|
|
|
(IN clause? Bucket = filterKey)? // bucket name
|
|
|
|
FROM Filter = identWC // filter reference or whole netmap
|
|
|
|
(AS Name = ident)? // optional selector name
|
2021-05-21 15:12:32 +00:00
|
|
|
;
|
|
|
|
|
|
|
|
clause: CLAUSE_SAME | CLAUSE_DISTINCT; // nodes from distinct buckets
|
|
|
|
|
|
|
|
filterExpr:
|
2023-05-24 09:50:13 +00:00
|
|
|
Op = NOT_OP '(' F1 = filterExpr ')'
|
|
|
|
| F1 = filterExpr Op = AND_OP F2 = filterExpr
|
2021-05-21 15:12:32 +00:00
|
|
|
| F1 = filterExpr Op = OR_OP F2 = filterExpr
|
2021-05-21 15:12:27 +00:00
|
|
|
| '(' Inner = filterExpr ')'
|
2021-05-21 15:12:32 +00:00
|
|
|
| expr
|
|
|
|
;
|
|
|
|
|
|
|
|
filterStmt:
|
|
|
|
FILTER Expr = filterExpr
|
|
|
|
AS Name = ident // obligatory filter name
|
|
|
|
;
|
|
|
|
|
|
|
|
expr:
|
|
|
|
AT Filter = ident // reference to named filter
|
|
|
|
| Key = filterKey SIMPLE_OP Value = filterValue // attribute comparison
|
|
|
|
;
|
|
|
|
|
|
|
|
filterKey : ident | STRING;
|
|
|
|
filterValue : ident | number | STRING;
|
|
|
|
number : ZERO | NUMBER1;
|
|
|
|
keyword : REP | IN | AS | SELECT | FROM | FILTER;
|
|
|
|
ident : keyword | IDENT;
|
|
|
|
identWC : ident | WILDCARD;
|