-
Notifications
You must be signed in to change notification settings - Fork 25.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ESQL: Break up antlr #122075
ESQL: Break up antlr #122075
Conversation
I'm not sure if we want this. I want this, but it conflicts with a few things we mention in the ANTLR comments - that we want to prevent shifting around the token ids if possible - this makes that much much less likely because everything is ordered by its include. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM - we can't guarantee the token ids anyway since we're expanding existing modes (instead of adding them at then end).
Breaking down the lexer is going to help with contributions - we should do the same for the parser.
Pinging @elastic/es-analytical-engine (Team:Analytics) |
I've merged main into this to pickup some conflicts. The kibana folks will have to give this one a shot before I merge this. @drewdaemon or @stratoula will approve it when they are ready for it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❤️
I will open a PR on the Kibana side to take this update into account! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's go ahead with the merge!
49bbfc2
to
b197801
Compare
Pinging @elastic/kibana-esql (ES|QL-ui) |
💔 Backport failed
You can use sqren/backport to manually backport by running |
💚 All backports created successfully
Questions ?Please refer to the Backport tool documentation |
Co-authored-by: Fang Xing <[email protected]> (cherry picked from commit a792334) # Conflicts: # x-pack/plugin/esql/src/main/antlr/EsqlBaseLexer.g4 # x-pack/plugin/esql/src/main/antlr/EsqlBaseLexer.tokens # x-pack/plugin/esql/src/main/antlr/EsqlBaseParser.g4 # x-pack/plugin/esql/src/main/antlr/EsqlBaseParser.tokens # x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/parser/EsqlBaseLexer.interp # x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/parser/EsqlBaseLexer.java # x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/parser/EsqlBaseParser.interp # x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/parser/EsqlBaseParser.java # x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/parser/EsqlBaseParserBaseListener.java # x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/parser/EsqlBaseParserBaseVisitor.java # x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/parser/EsqlBaseParserListener.java # x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/parser/EsqlBaseParserVisitor.java
Co-authored-by: Fang Xing <[email protected]> (cherry picked from commit a792334) # Conflicts: # x-pack/plugin/esql/src/main/antlr/EsqlBaseLexer.g4 # x-pack/plugin/esql/src/main/antlr/EsqlBaseLexer.tokens # x-pack/plugin/esql/src/main/antlr/EsqlBaseParser.g4 # x-pack/plugin/esql/src/main/antlr/EsqlBaseParser.tokens # x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/parser/EsqlBaseLexer.interp # x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/parser/EsqlBaseLexer.java # x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/parser/EsqlBaseParser.interp # x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/parser/EsqlBaseParser.java # x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/parser/EsqlBaseParserBaseListener.java # x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/parser/EsqlBaseParserBaseVisitor.java # x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/parser/EsqlBaseParserListener.java # x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/parser/EsqlBaseParserVisitor.java Co-authored-by: Nik Everett <[email protected]>
"'+'", "'-'", "'*'", "'/'", "'%'", "'{'", "'}'", null, null, "']'", null, | ||
"')'", null, null, null, null, null, "'metadata'", null, null, null, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nik9000 sorry for the late-stage comment, but it's a little curious to me that we lost the literal names for LP
and OPENING_BRACKET
. It changes the syntax errors, for example
row var = 1 not in
used to result in
mismatched input '<EOF>' expecting '('
but now says
mismatched input '<EOF>' expecting LP
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was wrong... this regression was actually in 21845ad
This breaks the antlr lexer and parser into a few files rather than two giant files. It's much easier to read them this way.