Skip to content

Commit 6ea45d9

Browse files
committed
Grammar for ES|QL change point (with dummy impl)
1 parent c8dfb4e commit 6ea45d9

18 files changed

+2880
-2263
lines changed

x-pack/plugin/esql/src/main/antlr/EsqlBaseLexer.g4

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -84,15 +84,16 @@ WHERE : 'where' -> pushMode(EXPRESSION_MODE);
8484
// Once the command has been stabilized, remove the DEV_ prefix and the {}? conditional and move the command to the
8585
// main section while preserving alphabetical order:
8686
// MYCOMMAND : 'mycommand' -> ...
87-
DEV_INLINESTATS : {this.isDevVersion()}? 'inlinestats' -> pushMode(EXPRESSION_MODE);
88-
DEV_LOOKUP : {this.isDevVersion()}? 'lookup_🐔' -> pushMode(LOOKUP_MODE);
89-
DEV_METRICS : {this.isDevVersion()}? 'metrics' -> pushMode(METRICS_MODE);
87+
DEV_CHANGE_POINT : {this.isDevVersion()}? 'change_point' -> pushMode(CHANGE_POINT_MODE);
88+
DEV_INLINESTATS : {this.isDevVersion()}? 'inlinestats' -> pushMode(EXPRESSION_MODE);
89+
DEV_LOOKUP : {this.isDevVersion()}? 'lookup_🐔' -> pushMode(LOOKUP_MODE);
90+
DEV_METRICS : {this.isDevVersion()}? 'metrics' -> pushMode(METRICS_MODE);
9091
// list of all JOIN commands
91-
DEV_JOIN : {this.isDevVersion()}? 'join' -> pushMode(JOIN_MODE);
92-
DEV_JOIN_FULL : {this.isDevVersion()}? 'full' -> pushMode(JOIN_MODE);
93-
DEV_JOIN_LEFT : {this.isDevVersion()}? 'left' -> pushMode(JOIN_MODE);
94-
DEV_JOIN_RIGHT : {this.isDevVersion()}? 'right' -> pushMode(JOIN_MODE);
95-
DEV_JOIN_LOOKUP : {this.isDevVersion()}? 'lookup' -> pushMode(JOIN_MODE);
92+
DEV_JOIN : {this.isDevVersion()}? 'join' -> pushMode(JOIN_MODE);
93+
DEV_JOIN_FULL : {this.isDevVersion()}? 'full' -> pushMode(JOIN_MODE);
94+
DEV_JOIN_LEFT : {this.isDevVersion()}? 'left' -> pushMode(JOIN_MODE);
95+
DEV_JOIN_RIGHT : {this.isDevVersion()}? 'right' -> pushMode(JOIN_MODE);
96+
DEV_JOIN_LOOKUP : {this.isDevVersion()}? 'lookup' -> pushMode(JOIN_MODE);
9697

9798

9899
//
@@ -639,3 +640,21 @@ CLOSING_METRICS_BY
639640
CLOSING_METRICS_PIPE
640641
: PIPE -> type(PIPE), popMode
641642
;
643+
644+
///
645+
/// CHANGE_POINT command
646+
///
647+
mode CHANGE_POINT_MODE;
648+
649+
CHANGE_POINT_PIPE : PIPE -> type(PIPE), popMode;
650+
CHANGE_POINT_ON : ON -> type(ON);
651+
CHANGE_POINT_AS : AS -> type(AS);
652+
CHANGE_POINT_DOT: DOT -> type(DOT);
653+
CHANGE_POINT_COMMA: COMMA -> type(COMMA);
654+
CHANGE_POINT_QUOTED_IDENTIFIER: QUOTED_IDENTIFIER -> type(QUOTED_IDENTIFIER);
655+
CHANGE_POINT_UNQUOTED_IDENTIFIER: UNQUOTED_IDENTIFIER -> type(UNQUOTED_IDENTIFIER);
656+
CHANGE_POINT_LINE_COMMENT: LINE_COMMENT -> channel(HIDDEN);
657+
CHANGE_POINT_MULTILINE_COMMENT: MULTILINE_COMMENT -> channel(HIDDEN);
658+
CHANGE_POINT_WS: WS -> channel(HIDDEN);
659+
660+
// TODO: CHANGE_POINT_ON, CHANGE_POINT_AS

x-pack/plugin/esql/src/main/antlr/EsqlBaseLexer.tokens

Lines changed: 164 additions & 160 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

x-pack/plugin/esql/src/main/antlr/EsqlBaseParser.g4

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ processingCommand
5555
| {this.isDevVersion()}? inlinestatsCommand
5656
| {this.isDevVersion()}? lookupCommand
5757
| {this.isDevVersion()}? joinCommand
58+
| {this.isDevVersion()}? changePointCommand
5859
;
5960

6061
whereCommand
@@ -338,3 +339,8 @@ joinCondition
338339
joinPredicate
339340
: valueExpression
340341
;
342+
343+
// TODO: make ON/AS optional
344+
changePointCommand
345+
: DEV_CHANGE_POINT value=qualifiedName ON key=qualifiedName AS targetType=qualifiedName COMMA targetPvalue=qualifiedName
346+
;

0 commit comments

Comments
 (0)