[ES|QL] Introduce CstToAstConverter in query parsing#225987
[ES|QL] Introduce CstToAstConverter in query parsing#225987vadimkibana merged 7 commits intoelastic:mainfrom
CstToAstConverter in query parsing#225987Conversation
CstToAstConverter in query parsing
src/platform/packages/shared/kbn-esql-ast/src/parser/__tests__/keep.test.ts
Outdated
Show resolved
Hide resolved
src/platform/packages/shared/kbn-esql-ast/src/parser/cst_to_ast_converter.ts
Outdated
Show resolved
Hide resolved
c9f0d07 to
e1f4efc
Compare
|
Pinging @elastic/kibana-esql (Team:ESQL) |
stratoula
left a comment
There was a problem hiding this comment.
Looks great, I just have a question why we didnt remove the entire factories folder
src/platform/packages/shared/kbn-esql-ast/src/parser/__tests__/commands.test.ts
Show resolved
Hide resolved
src/platform/packages/shared/kbn-esql-ast/src/parser/factories/dissect.ts
Show resolved
Hide resolved
...kages/shared/kbn-esql-validation-autocomplete/src/validation/esql_validation_meta_tests.json
Show resolved
Hide resolved
@stratoula in the first PR I wanted to introduce |
💚 Build Succeeded
Metrics [docs]Module Count
Public APIs missing comments
Async chunks
Public APIs missing exports
Page load bundle
Unknown metric groupsAPI count
References to deprecated APIs
History
|
|
Nice! I like it! |
## Summary Partially addresses elastic#222505 - Stops using ANTLR's listener API through `ESQLAstBuilderListener` (`ESQLAstBuilderListener` is completely removed) for ES|QL query parsing. Now all ANTLR CST (Concrete Syntax Tree) to AST (Abstract Syntax Tree) conversion is done by traversing the CST directly. - Consolidates most of the CST-to-AST conversion logic in the `CstToAstConverter` class. - In the future all conversion logic will be moved to the `CstToAstConverter` class. - This change now allows us to parse nested sub-queries, like: - `EXPLAIN [ EXPLAIN [ FROM index ] ]` - In the future: `FROM index | WHERE foo IN (FROM bar | KEEP baz)` - Improves `FORK` command parsing, now `FORK` command does not need to handle special cases of sub-query parsing, sub-query parsing "just works". - Fixes `SHOW INFO` command parsing. - Adds parsing unit tests for commands, which did no have them. ### Checklist - [x] [Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html) was added for features that require explanation or tutorials
Summary
Partially addresses #222505
ESQLAstBuilderListener(ESQLAstBuilderListeneris completely removed) for ES|QL query parsing. Now all ANTLR CST (Concrete Syntax Tree) to AST (Abstract Syntax Tree) conversion is done by traversing the CST directly.CstToAstConverterclass.CstToAstConverterclass.EXPLAIN [ EXPLAIN [ FROM index ] ]FROM index | WHERE foo IN (FROM bar | KEEP baz)FORKcommand parsing, nowFORKcommand does not need to handle special cases of sub-query parsing, sub-query parsing "just works".SHOW INFOcommand parsing.Checklist