Conversation
|
Pinging @elastic/kibana-esql (Team:ESQL) |
stratoula
left a comment
There was a problem hiding this comment.
Looks great, thanx for working on this. I know it was hard 👏
|
The failure in the jest test is very alarming 🤔 |
…ana into esql_grammar_sync_1741050179
|
@stratoula that test used an invalid query (extra parenthesis). The parser used be more forgiving of that kind of mistake, so I think the problem with the tested query got missed because it still generated an AST. With the changes here from Elasticsearch, the parser instead throws a "Stack empty" error and gives up, leading to an empty result. So, it's just a matter of correcting the query in that particular test case. |
|
Ah great catch! Opening and closing parenthesis are so difficult to follow sometimes |
|
@elasticmachine merge upstream |
💚 Build Succeeded
Metrics [docs]Page load bundle
History
cc @drewdaemon |
|
Starting backport for target branches: 8.x https://github.com/elastic/kibana/actions/runs/13931820929 |
This PR updates the ES|QL grammars (lexer and parser) to match the latest version in Elasticsearch. --------- Co-authored-by: drewdaemon <drew.tate@elastic.co> Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com> Co-authored-by: Stratoula Kalafateli <efstratia.kalafateli@elastic.co> (cherry picked from commit 681295f)
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
# Backport This will backport the following commits from `main` to `8.x`: - [[ES|QL] Update grammars (#213006)](#213006) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Kibana Machine","email":"42973632+kibanamachine@users.noreply.github.com"},"sourceCommit":{"committedDate":"2025-03-18T19:25:57Z","message":"[ES|QL] Update grammars (#213006)\n\nThis PR updates the ES|QL grammars (lexer and parser) to match the\nlatest version in Elasticsearch.\n\n---------\n\nCo-authored-by: drewdaemon <drew.tate@elastic.co>\nCo-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>\nCo-authored-by: Stratoula Kalafateli <efstratia.kalafateli@elastic.co>","sha":"681295ff9ee5bb421d974452aa023284f4152d33","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:ESQL","backport:version","v9.1.0","v8.19.0"],"title":"[ES|QL] Update grammars","number":213006,"url":"https://github.com/elastic/kibana/pull/213006","mergeCommit":{"message":"[ES|QL] Update grammars (#213006)\n\nThis PR updates the ES|QL grammars (lexer and parser) to match the\nlatest version in Elasticsearch.\n\n---------\n\nCo-authored-by: drewdaemon <drew.tate@elastic.co>\nCo-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>\nCo-authored-by: Stratoula Kalafateli <efstratia.kalafateli@elastic.co>","sha":"681295ff9ee5bb421d974452aa023284f4152d33"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/213006","number":213006,"mergeCommit":{"message":"[ES|QL] Update grammars (#213006)\n\nThis PR updates the ES|QL grammars (lexer and parser) to match the\nlatest version in Elasticsearch.\n\n---------\n\nCo-authored-by: drewdaemon <drew.tate@elastic.co>\nCo-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>\nCo-authored-by: Stratoula Kalafateli <efstratia.kalafateli@elastic.co>","sha":"681295ff9ee5bb421d974452aa023284f4152d33"}},{"branch":"8.x","label":"v8.19.0","branchLabelMappingKey":"^v8.19.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT-->
This PR updates the ES|QL grammars (lexer and parser) to match the latest version in Elasticsearch. --------- Co-authored-by: drewdaemon <drew.tate@elastic.co> Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com> Co-authored-by: Stratoula Kalafateli <efstratia.kalafateli@elastic.co>
This PR updates the ES|QL grammars (lexer and parser) to match the latest version in Elasticsearch. --------- Co-authored-by: drewdaemon <drew.tate@elastic.co> Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com> Co-authored-by: Stratoula Kalafateli <efstratia.kalafateli@elastic.co>
This PR updates the ES|QL grammars (lexer and parser) to match the latest version in Elasticsearch. --------- Co-authored-by: drewdaemon <drew.tate@elastic.co> Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com> Co-authored-by: Stratoula Kalafateli <efstratia.kalafateli@elastic.co>
This PR updates the ES|QL grammars (lexer and parser) to match the latest version in Elasticsearch. --------- Co-authored-by: drewdaemon <drew.tate@elastic.co> Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com> Co-authored-by: Stratoula Kalafateli <efstratia.kalafateli@elastic.co>
## Summary Part of #215092 ## Considerations ### `RRF` may change in the future @ioanatia has stated that the command may change in the future as it's not fully implemented yet. ### Licence check Will be addressed at #216791 https://github.com/user-attachments/assets/759470a2-4afa-4d20-adbf-cb3001895e95 ## New command support checklist ### AST support - [x] Make sure that the new command is in the local Kibana grammar definition. The ANTLR lexer and parser files are updated every Monday from the source definition of the language at Elasticsearch (via a manually merged, automatically generated [PR](#213006)). - [x] Create a factory for generating the new node. The new node should satisfy the `ESQLCommand<Name>` interface. If the syntax of your command cannot be decomposed only in parameters, you can hold extra information by extending the `ESQLCommand` interface. I.E., check the Rerank command. - [x] While ANTLR is parsing the text query, we create our own AST by using `onExit` listeners at `kbn-esql-ast/src/parser/esql_ast_builder_listener.ts`. Implement the `onExit<COMMAND_NAME>` method based on the interface autogenerated by ANTLR and push the new node into the AST. - [x] Create unit tests checking that the correct AST nodes are generated when parsing your command. - [x] Add a dedicated [visitor callback](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-esql-ast/src/visitor/README.md) for the new command. - [x] Verify that the `Walker` API can visit the new node. - [x] Verify that the `Synth` API can construct the new node. ### Validating that the command works well when prettifying the query - [x] Validate that the prettifier works correctly. - [ ] Adjust the basic pretty printer and the wrapping pretty printer if needed. - [x] Add unit tests validating that the queries are correctly formatted (even if no adjustment has been done). ### Creating the command definition - [x] Add the definition of the new command at `kbn-esql-validation-autocomplete/src/definitions/commands.ts`. ### Adding the corresponding client-side validations - [x] Add a custom validation if needed. - [x] Add tests checking the behavior of the validation following this [guide](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-esql-validation-autocomplete/README.md#the-new-way). ### Adding the autocomplete suggestions - [x] Add the suggestions to be shown when **positioned at** the new command. - [x] Create a new folder at `kbn-esql-validation-autocomplete/src/autocomplete/commands` for your command. - [x] Export a `suggest` function that should return an array of suggestions and set it up into the command definition. - [ ] Optionally, we must filter or incorporate fields suggestions after a command is executed, this is supported by adding the `fieldsSuggestionsAfter` method to the command definition. Read this documentation to understand how it works. - [x] If the new command must be suggested only in particular situations, modify the corresponding suggestions to make it possible. - [x] Add tests following this [guide](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-esql-validation-autocomplete/README.md#automated-testing). ### Checklist Check the PR satisfies following conditions. Reviewers should verify this PR satisfies this list as well. - [ ] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md) - [ ] [Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html) was added for features that require explanation or tutorials - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios - [ ] If a plugin configuration key changed, check if it needs to be allowlisted in the cloud and added to the [docker list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker) - [ ] This was checked for breaking HTTP API changes, and any breaking changes have been approved by the breaking-change committee. The `release_note:breaking` label should be applied in these situations. - [ ] [Flaky Test Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was used on any tests changed - [ ] The PR description includes the appropriate Release Notes section, and the correct `release_note:*` label is applied per the [guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) ### Identify risks Does this PR introduce any risks? For example, consider risks like hard to test bugs, performance regression, potential of data loss. Describe the risk, its severity, and mitigation for each identified risk. Invite stakeholders and evaluate how to proceed before merging. - [ ] [See some risk examples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx) - [ ] ... --------- Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com> Co-authored-by: Stratoula Kalafateli <efstratia.kalafateli@elastic.co> Co-authored-by: Drew Tate <drewctate@gmail.com>
## Summary Part of elastic#215092 ## Considerations ### `RRF` may change in the future @ioanatia has stated that the command may change in the future as it's not fully implemented yet. ### Licence check Will be addressed at elastic#216791 https://github.com/user-attachments/assets/759470a2-4afa-4d20-adbf-cb3001895e95 ## New command support checklist ### AST support - [x] Make sure that the new command is in the local Kibana grammar definition. The ANTLR lexer and parser files are updated every Monday from the source definition of the language at Elasticsearch (via a manually merged, automatically generated [PR](elastic#213006)). - [x] Create a factory for generating the new node. The new node should satisfy the `ESQLCommand<Name>` interface. If the syntax of your command cannot be decomposed only in parameters, you can hold extra information by extending the `ESQLCommand` interface. I.E., check the Rerank command. - [x] While ANTLR is parsing the text query, we create our own AST by using `onExit` listeners at `kbn-esql-ast/src/parser/esql_ast_builder_listener.ts`. Implement the `onExit<COMMAND_NAME>` method based on the interface autogenerated by ANTLR and push the new node into the AST. - [x] Create unit tests checking that the correct AST nodes are generated when parsing your command. - [x] Add a dedicated [visitor callback](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-esql-ast/src/visitor/README.md) for the new command. - [x] Verify that the `Walker` API can visit the new node. - [x] Verify that the `Synth` API can construct the new node. ### Validating that the command works well when prettifying the query - [x] Validate that the prettifier works correctly. - [ ] Adjust the basic pretty printer and the wrapping pretty printer if needed. - [x] Add unit tests validating that the queries are correctly formatted (even if no adjustment has been done). ### Creating the command definition - [x] Add the definition of the new command at `kbn-esql-validation-autocomplete/src/definitions/commands.ts`. ### Adding the corresponding client-side validations - [x] Add a custom validation if needed. - [x] Add tests checking the behavior of the validation following this [guide](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-esql-validation-autocomplete/README.md#the-new-way). ### Adding the autocomplete suggestions - [x] Add the suggestions to be shown when **positioned at** the new command. - [x] Create a new folder at `kbn-esql-validation-autocomplete/src/autocomplete/commands` for your command. - [x] Export a `suggest` function that should return an array of suggestions and set it up into the command definition. - [ ] Optionally, we must filter or incorporate fields suggestions after a command is executed, this is supported by adding the `fieldsSuggestionsAfter` method to the command definition. Read this documentation to understand how it works. - [x] If the new command must be suggested only in particular situations, modify the corresponding suggestions to make it possible. - [x] Add tests following this [guide](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-esql-validation-autocomplete/README.md#automated-testing). ### Checklist Check the PR satisfies following conditions. Reviewers should verify this PR satisfies this list as well. - [ ] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md) - [ ] [Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html) was added for features that require explanation or tutorials - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios - [ ] If a plugin configuration key changed, check if it needs to be allowlisted in the cloud and added to the [docker list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker) - [ ] This was checked for breaking HTTP API changes, and any breaking changes have been approved by the breaking-change committee. The `release_note:breaking` label should be applied in these situations. - [ ] [Flaky Test Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was used on any tests changed - [ ] The PR description includes the appropriate Release Notes section, and the correct `release_note:*` label is applied per the [guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) ### Identify risks Does this PR introduce any risks? For example, consider risks like hard to test bugs, performance regression, potential of data loss. Describe the risk, its severity, and mitigation for each identified risk. Invite stakeholders and evaluate how to proceed before merging. - [ ] [See some risk examples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx) - [ ] ... --------- Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com> Co-authored-by: Stratoula Kalafateli <efstratia.kalafateli@elastic.co> Co-authored-by: Drew Tate <drewctate@gmail.com> (cherry picked from commit 0794030) # Conflicts: # src/platform/packages/shared/kbn-esql-validation-autocomplete/src/definitions/commands.ts
## Summary Part of elastic#215092 ## Considerations ### `RRF` may change in the future @ioanatia has stated that the command may change in the future as it's not fully implemented yet. ### Licence check Will be addressed at elastic#216791 https://github.com/user-attachments/assets/759470a2-4afa-4d20-adbf-cb3001895e95 ## New command support checklist ### AST support - [x] Make sure that the new command is in the local Kibana grammar definition. The ANTLR lexer and parser files are updated every Monday from the source definition of the language at Elasticsearch (via a manually merged, automatically generated [PR](elastic#213006)). - [x] Create a factory for generating the new node. The new node should satisfy the `ESQLCommand<Name>` interface. If the syntax of your command cannot be decomposed only in parameters, you can hold extra information by extending the `ESQLCommand` interface. I.E., check the Rerank command. - [x] While ANTLR is parsing the text query, we create our own AST by using `onExit` listeners at `kbn-esql-ast/src/parser/esql_ast_builder_listener.ts`. Implement the `onExit<COMMAND_NAME>` method based on the interface autogenerated by ANTLR and push the new node into the AST. - [x] Create unit tests checking that the correct AST nodes are generated when parsing your command. - [x] Add a dedicated [visitor callback](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-esql-ast/src/visitor/README.md) for the new command. - [x] Verify that the `Walker` API can visit the new node. - [x] Verify that the `Synth` API can construct the new node. ### Validating that the command works well when prettifying the query - [x] Validate that the prettifier works correctly. - [ ] Adjust the basic pretty printer and the wrapping pretty printer if needed. - [x] Add unit tests validating that the queries are correctly formatted (even if no adjustment has been done). ### Creating the command definition - [x] Add the definition of the new command at `kbn-esql-validation-autocomplete/src/definitions/commands.ts`. ### Adding the corresponding client-side validations - [x] Add a custom validation if needed. - [x] Add tests checking the behavior of the validation following this [guide](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-esql-validation-autocomplete/README.md#the-new-way). ### Adding the autocomplete suggestions - [x] Add the suggestions to be shown when **positioned at** the new command. - [x] Create a new folder at `kbn-esql-validation-autocomplete/src/autocomplete/commands` for your command. - [x] Export a `suggest` function that should return an array of suggestions and set it up into the command definition. - [ ] Optionally, we must filter or incorporate fields suggestions after a command is executed, this is supported by adding the `fieldsSuggestionsAfter` method to the command definition. Read this documentation to understand how it works. - [x] If the new command must be suggested only in particular situations, modify the corresponding suggestions to make it possible. - [x] Add tests following this [guide](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-esql-validation-autocomplete/README.md#automated-testing). ### Checklist Check the PR satisfies following conditions. Reviewers should verify this PR satisfies this list as well. - [ ] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md) - [ ] [Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html) was added for features that require explanation or tutorials - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios - [ ] If a plugin configuration key changed, check if it needs to be allowlisted in the cloud and added to the [docker list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker) - [ ] This was checked for breaking HTTP API changes, and any breaking changes have been approved by the breaking-change committee. The `release_note:breaking` label should be applied in these situations. - [ ] [Flaky Test Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was used on any tests changed - [ ] The PR description includes the appropriate Release Notes section, and the correct `release_note:*` label is applied per the [guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) ### Identify risks Does this PR introduce any risks? For example, consider risks like hard to test bugs, performance regression, potential of data loss. Describe the risk, its severity, and mitigation for each identified risk. Invite stakeholders and evaluate how to proceed before merging. - [ ] [See some risk examples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx) - [ ] ... --------- Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com> Co-authored-by: Stratoula Kalafateli <efstratia.kalafateli@elastic.co> Co-authored-by: Drew Tate <drewctate@gmail.com> (cherry picked from commit 0794030) # Conflicts: # src/platform/packages/shared/kbn-esql-validation-autocomplete/src/definitions/commands.ts
## Summary Part of elastic#215092 ## Considerations ### `RRF` may change in the future @ioanatia has stated that the command may change in the future as it's not fully implemented yet. ### Licence check Will be addressed at elastic#216791 https://github.com/user-attachments/assets/759470a2-4afa-4d20-adbf-cb3001895e95 ## New command support checklist ### AST support - [x] Make sure that the new command is in the local Kibana grammar definition. The ANTLR lexer and parser files are updated every Monday from the source definition of the language at Elasticsearch (via a manually merged, automatically generated [PR](elastic#213006)). - [x] Create a factory for generating the new node. The new node should satisfy the `ESQLCommand<Name>` interface. If the syntax of your command cannot be decomposed only in parameters, you can hold extra information by extending the `ESQLCommand` interface. I.E., check the Rerank command. - [x] While ANTLR is parsing the text query, we create our own AST by using `onExit` listeners at `kbn-esql-ast/src/parser/esql_ast_builder_listener.ts`. Implement the `onExit<COMMAND_NAME>` method based on the interface autogenerated by ANTLR and push the new node into the AST. - [x] Create unit tests checking that the correct AST nodes are generated when parsing your command. - [x] Add a dedicated [visitor callback](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-esql-ast/src/visitor/README.md) for the new command. - [x] Verify that the `Walker` API can visit the new node. - [x] Verify that the `Synth` API can construct the new node. ### Validating that the command works well when prettifying the query - [x] Validate that the prettifier works correctly. - [ ] Adjust the basic pretty printer and the wrapping pretty printer if needed. - [x] Add unit tests validating that the queries are correctly formatted (even if no adjustment has been done). ### Creating the command definition - [x] Add the definition of the new command at `kbn-esql-validation-autocomplete/src/definitions/commands.ts`. ### Adding the corresponding client-side validations - [x] Add a custom validation if needed. - [x] Add tests checking the behavior of the validation following this [guide](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-esql-validation-autocomplete/README.md#the-new-way). ### Adding the autocomplete suggestions - [x] Add the suggestions to be shown when **positioned at** the new command. - [x] Create a new folder at `kbn-esql-validation-autocomplete/src/autocomplete/commands` for your command. - [x] Export a `suggest` function that should return an array of suggestions and set it up into the command definition. - [ ] Optionally, we must filter or incorporate fields suggestions after a command is executed, this is supported by adding the `fieldsSuggestionsAfter` method to the command definition. Read this documentation to understand how it works. - [x] If the new command must be suggested only in particular situations, modify the corresponding suggestions to make it possible. - [x] Add tests following this [guide](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-esql-validation-autocomplete/README.md#automated-testing). ### Checklist Check the PR satisfies following conditions. Reviewers should verify this PR satisfies this list as well. - [ ] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md) - [ ] [Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html) was added for features that require explanation or tutorials - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios - [ ] If a plugin configuration key changed, check if it needs to be allowlisted in the cloud and added to the [docker list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker) - [ ] This was checked for breaking HTTP API changes, and any breaking changes have been approved by the breaking-change committee. The `release_note:breaking` label should be applied in these situations. - [ ] [Flaky Test Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was used on any tests changed - [ ] The PR description includes the appropriate Release Notes section, and the correct `release_note:*` label is applied per the [guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) ### Identify risks Does this PR introduce any risks? For example, consider risks like hard to test bugs, performance regression, potential of data loss. Describe the risk, its severity, and mitigation for each identified risk. Invite stakeholders and evaluate how to proceed before merging. - [ ] [See some risk examples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx) - [ ] ... --------- Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com> Co-authored-by: Stratoula Kalafateli <efstratia.kalafateli@elastic.co> Co-authored-by: Drew Tate <drewctate@gmail.com> (cherry picked from commit 0794030)
## Summary Part of elastic#215092 ## Considerations ### `RRF` may change in the future @ioanatia has stated that the command may change in the future as it's not fully implemented yet. ### Licence check Will be addressed at elastic#216791 https://github.com/user-attachments/assets/759470a2-4afa-4d20-adbf-cb3001895e95 ## New command support checklist ### AST support - [x] Make sure that the new command is in the local Kibana grammar definition. The ANTLR lexer and parser files are updated every Monday from the source definition of the language at Elasticsearch (via a manually merged, automatically generated [PR](elastic#213006)). - [x] Create a factory for generating the new node. The new node should satisfy the `ESQLCommand<Name>` interface. If the syntax of your command cannot be decomposed only in parameters, you can hold extra information by extending the `ESQLCommand` interface. I.E., check the Rerank command. - [x] While ANTLR is parsing the text query, we create our own AST by using `onExit` listeners at `kbn-esql-ast/src/parser/esql_ast_builder_listener.ts`. Implement the `onExit<COMMAND_NAME>` method based on the interface autogenerated by ANTLR and push the new node into the AST. - [x] Create unit tests checking that the correct AST nodes are generated when parsing your command. - [x] Add a dedicated [visitor callback](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-esql-ast/src/visitor/README.md) for the new command. - [x] Verify that the `Walker` API can visit the new node. - [x] Verify that the `Synth` API can construct the new node. ### Validating that the command works well when prettifying the query - [x] Validate that the prettifier works correctly. - [ ] Adjust the basic pretty printer and the wrapping pretty printer if needed. - [x] Add unit tests validating that the queries are correctly formatted (even if no adjustment has been done). ### Creating the command definition - [x] Add the definition of the new command at `kbn-esql-validation-autocomplete/src/definitions/commands.ts`. ### Adding the corresponding client-side validations - [x] Add a custom validation if needed. - [x] Add tests checking the behavior of the validation following this [guide](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-esql-validation-autocomplete/README.md#the-new-way). ### Adding the autocomplete suggestions - [x] Add the suggestions to be shown when **positioned at** the new command. - [x] Create a new folder at `kbn-esql-validation-autocomplete/src/autocomplete/commands` for your command. - [x] Export a `suggest` function that should return an array of suggestions and set it up into the command definition. - [ ] Optionally, we must filter or incorporate fields suggestions after a command is executed, this is supported by adding the `fieldsSuggestionsAfter` method to the command definition. Read this documentation to understand how it works. - [x] If the new command must be suggested only in particular situations, modify the corresponding suggestions to make it possible. - [x] Add tests following this [guide](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-esql-validation-autocomplete/README.md#automated-testing). ### Checklist Check the PR satisfies following conditions. Reviewers should verify this PR satisfies this list as well. - [ ] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md) - [ ] [Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html) was added for features that require explanation or tutorials - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios - [ ] If a plugin configuration key changed, check if it needs to be allowlisted in the cloud and added to the [docker list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker) - [ ] This was checked for breaking HTTP API changes, and any breaking changes have been approved by the breaking-change committee. The `release_note:breaking` label should be applied in these situations. - [ ] [Flaky Test Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was used on any tests changed - [ ] The PR description includes the appropriate Release Notes section, and the correct `release_note:*` label is applied per the [guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) ### Identify risks Does this PR introduce any risks? For example, consider risks like hard to test bugs, performance regression, potential of data loss. Describe the risk, its severity, and mitigation for each identified risk. Invite stakeholders and evaluate how to proceed before merging. - [ ] [See some risk examples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx) - [ ] ... --------- Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com> Co-authored-by: Stratoula Kalafateli <efstratia.kalafateli@elastic.co> Co-authored-by: Drew Tate <drewctate@gmail.com>
## Summary Part of elastic#215092 ## Considerations ### `RRF` may change in the future @ioanatia has stated that the command may change in the future as it's not fully implemented yet. ### Licence check Will be addressed at elastic#216791 https://github.com/user-attachments/assets/759470a2-4afa-4d20-adbf-cb3001895e95 ## New command support checklist ### AST support - [x] Make sure that the new command is in the local Kibana grammar definition. The ANTLR lexer and parser files are updated every Monday from the source definition of the language at Elasticsearch (via a manually merged, automatically generated [PR](elastic#213006)). - [x] Create a factory for generating the new node. The new node should satisfy the `ESQLCommand<Name>` interface. If the syntax of your command cannot be decomposed only in parameters, you can hold extra information by extending the `ESQLCommand` interface. I.E., check the Rerank command. - [x] While ANTLR is parsing the text query, we create our own AST by using `onExit` listeners at `kbn-esql-ast/src/parser/esql_ast_builder_listener.ts`. Implement the `onExit<COMMAND_NAME>` method based on the interface autogenerated by ANTLR and push the new node into the AST. - [x] Create unit tests checking that the correct AST nodes are generated when parsing your command. - [x] Add a dedicated [visitor callback](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-esql-ast/src/visitor/README.md) for the new command. - [x] Verify that the `Walker` API can visit the new node. - [x] Verify that the `Synth` API can construct the new node. ### Validating that the command works well when prettifying the query - [x] Validate that the prettifier works correctly. - [ ] Adjust the basic pretty printer and the wrapping pretty printer if needed. - [x] Add unit tests validating that the queries are correctly formatted (even if no adjustment has been done). ### Creating the command definition - [x] Add the definition of the new command at `kbn-esql-validation-autocomplete/src/definitions/commands.ts`. ### Adding the corresponding client-side validations - [x] Add a custom validation if needed. - [x] Add tests checking the behavior of the validation following this [guide](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-esql-validation-autocomplete/README.md#the-new-way). ### Adding the autocomplete suggestions - [x] Add the suggestions to be shown when **positioned at** the new command. - [x] Create a new folder at `kbn-esql-validation-autocomplete/src/autocomplete/commands` for your command. - [x] Export a `suggest` function that should return an array of suggestions and set it up into the command definition. - [ ] Optionally, we must filter or incorporate fields suggestions after a command is executed, this is supported by adding the `fieldsSuggestionsAfter` method to the command definition. Read this documentation to understand how it works. - [x] If the new command must be suggested only in particular situations, modify the corresponding suggestions to make it possible. - [x] Add tests following this [guide](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-esql-validation-autocomplete/README.md#automated-testing). ### Checklist Check the PR satisfies following conditions. Reviewers should verify this PR satisfies this list as well. - [ ] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md) - [ ] [Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html) was added for features that require explanation or tutorials - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios - [ ] If a plugin configuration key changed, check if it needs to be allowlisted in the cloud and added to the [docker list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker) - [ ] This was checked for breaking HTTP API changes, and any breaking changes have been approved by the breaking-change committee. The `release_note:breaking` label should be applied in these situations. - [ ] [Flaky Test Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was used on any tests changed - [ ] The PR description includes the appropriate Release Notes section, and the correct `release_note:*` label is applied per the [guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) ### Identify risks Does this PR introduce any risks? For example, consider risks like hard to test bugs, performance regression, potential of data loss. Describe the risk, its severity, and mitigation for each identified risk. Invite stakeholders and evaluate how to proceed before merging. - [ ] [See some risk examples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx) - [ ] ... --------- Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com> Co-authored-by: Stratoula Kalafateli <efstratia.kalafateli@elastic.co> Co-authored-by: Drew Tate <drewctate@gmail.com>
This PR updates the ES|QL grammars (lexer and parser) to match the latest version in Elasticsearch.