Skip to content

Commit 621d248

Browse files
elastic-vault-github-plugin-prod[bot]elasticmachinestratoula
authored
feat: Update grammars (#59)
This PR updates the ES|QL grammars (lexer and parser) and PromQL grammars to match the latest version in Elasticsearch. Co-authored-by: Grammar Sync Bot <elasticmachine@users.noreply.github.com> Co-authored-by: Stratou <stratoula1@gmail.com>
1 parent 019a112 commit 621d248

9 files changed

Lines changed: 1990 additions & 1904 deletions

File tree

src/parser/antlr/esql_lexer.interp

Lines changed: 4 additions & 4 deletions
Large diffs are not rendered by default.

src/parser/antlr/esql_lexer.tokens

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ DEV_JOIN_FULL=30
3131
DEV_JOIN_LEFT=31
3232
DEV_JOIN_RIGHT=32
3333
DEV_LOOKUP=33
34-
DEV_MMR=34
34+
MMR=34
3535
MV_EXPAND=35
3636
DROP=36
3737
KEEP=37
@@ -189,6 +189,7 @@ SHOW_WS=168
189189
'inline'=27
190190
'inlinestats'=28
191191
'lookup'=29
192+
'mmr'=34
192193
'mv_expand'=35
193194
'drop'=36
194195
'keep'=37

src/parser/antlr/esql_lexer.ts

Lines changed: 662 additions & 672 deletions
Large diffs are not rendered by default.

src/parser/antlr/esql_parser.g4

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,10 @@ processingCommand
7575
| metricsInfoCommand
7676
| registeredDomainCommand
7777
| tsInfoCommand
78+
| mmrCommand
7879
// in development
7980
| {this.isDevVersion()}? lookupCommand
8081
| {this.isDevVersion()}? insistCommand
81-
| {this.isDevVersion()}? mmrCommand
8282
;
8383

8484
whereCommand
@@ -223,7 +223,11 @@ stringOrParameter
223223
;
224224

225225
limitCommand
226-
: LIMIT constant
226+
: LIMIT constant limitByGroupKey?
227+
;
228+
229+
limitByGroupKey:
230+
{this.isDevVersion()}? BY grouping=fields
227231
;
228232

229233
sortCommand
@@ -395,7 +399,7 @@ setField
395399
;
396400

397401
mmrCommand
398-
: DEV_MMR (queryVector=mmrQueryVectorParams)? ON diversifyField=qualifiedName MMR_LIMIT limitValue=integerValue commandNamedParameters
402+
: MMR (queryVector=mmrQueryVectorParams)? ON diversifyField=qualifiedName MMR_LIMIT limitValue=integerValue commandNamedParameters
399403
;
400404

401405
mmrQueryVectorParams

src/parser/antlr/esql_parser.interp

Lines changed: 4 additions & 3 deletions
Large diffs are not rendered by default.

src/parser/antlr/esql_parser.tokens

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ DEV_JOIN_FULL=30
3131
DEV_JOIN_LEFT=31
3232
DEV_JOIN_RIGHT=32
3333
DEV_LOOKUP=33
34-
DEV_MMR=34
34+
MMR=34
3535
MV_EXPAND=35
3636
DROP=36
3737
KEEP=37
@@ -189,6 +189,7 @@ SHOW_WS=168
189189
'inline'=27
190190
'inlinestats'=28
191191
'lookup'=29
192+
'mmr'=34
192193
'mv_expand'=35
193194
'drop'=36
194195
'keep'=37

0 commit comments

Comments
 (0)