Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions docs/changelog/123085.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pr: 123085
summary: Remove duplicated nested commands
area: ES|QL
type: bug
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

definitely a bug, but it should not escape into a published artifact or release.

issues: []
9 changes: 4 additions & 5 deletions x-pack/plugin/esql/src/main/antlr/EsqlBaseLexer.g4
Original file line number Diff line number Diff line change
Expand Up @@ -195,14 +195,12 @@ IN: 'in';
IS: 'is';
LAST : 'last';
LIKE: 'like';
LP : '(';
NOT : 'not';
NULL : 'null';
NULLS : 'nulls';
OR : 'or';
PARAM: '?';
RLIKE: 'rlike';
RP : ')';
TRUE : 'true';

EQ : '==';
Expand All @@ -223,8 +221,6 @@ LEFT_BRACES : '{';
RIGHT_BRACES : '}';

NESTED_WHERE : WHERE -> type(WHERE);
NESTED_SORT : {this.isDevVersion()}? SORT -> type(SORT);
NESTED_LIMIT : {this.isDevVersion()}? LIMIT -> type(LIMIT);
Comment on lines -226 to -227
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These cause parsing error since commands don't need to be nested. WHERE is declared here for the STATS avg() WHERE declaration -WHERE inside a command.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it. Thank you.


NAMED_OR_POSITIONAL_PARAM
: PARAM (LETTER | UNDERSCORE) UNQUOTED_ID_BODY*
Expand All @@ -239,6 +235,9 @@ NAMED_OR_POSITIONAL_PARAM
OPENING_BRACKET : '[' -> pushMode(EXPRESSION_MODE), pushMode(EXPRESSION_MODE);
CLOSING_BRACKET : ']' -> popMode, popMode;

LP : '(' -> pushMode(EXPRESSION_MODE), pushMode(EXPRESSION_MODE);
RP : ')' -> popMode, popMode;

UNQUOTED_IDENTIFIER
: LETTER UNQUOTED_ID_BODY*
// only allow @ at beginning of identifier to keep the option to allow @ as infix operator in the future
Expand Down Expand Up @@ -678,8 +677,8 @@ INSIST_MULTILINE_COMMENT : MULTILINE_COMMENT -> channel(HIDDEN);
//
mode FORK_MODE;
FORK_LP : LP -> type(LP), pushMode(DEFAULT_MODE);
FORK_RP : RP -> type(RP), popMode;
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The popup mode should already be completed by the sub fork, otherwise the mode stack is not completed, causing non-first subqueries to fail (since parsing is executed in a different mode).

FORK_PIPE : PIPE -> type(PIPE), popMode;

FORK_WS : WS -> channel(HIDDEN);
FORK_LINE_COMMENT : LINE_COMMENT -> channel(HIDDEN);
FORK_MULTILINE_COMMENT : MULTILINE_COMMENT -> channel(HIDDEN);
99 changes: 49 additions & 50 deletions x-pack/plugin/esql/src/main/antlr/EsqlBaseLexer.tokens

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

99 changes: 49 additions & 50 deletions x-pack/plugin/esql/src/main/antlr/EsqlBaseParser.tokens

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Large diffs are not rendered by default.

Loading