-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[ES|QL] More AST mutation APIs #196240
[ES|QL] More AST mutation APIs #196240
Conversation
/ci |
Pinging @elastic/kibana-esql (Team:ESQL) |
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.
This is super nice, LGTM!
Starting backport for target branches: 8.x https://github.com/elastic/kibana/actions/runs/11349628924 |
💚 Build Succeeded
Metrics [docs]Page load bundle
History
|
## Summary Partially addresses elastic#191812 Implements the following high-level ES|QL AST manipulation methods: - `.generic` - `.appendCommandArgument()` — Add a new main command argument to a command. - `.removeCommandArgument()` — Remove a command argument from the AST. - `.commands` - `.from` - `.sources` - `.list()` — List all `FROM` sources. - `.find()` — Find a source by name. - `.remove()` — Remove a source by name. - `.insert()` — Insert a source. - `.upsert()` — Insert a source, if it does not exist. - `.limit` - `.list()` — List all `LIMIT` commands. - `.byIndex()` — Find a `LIMIT` command by index. - `.find()` — Find a `LIMIT` command by a predicate function. - `.remove()` — Remove a `LIMIT` command by index. - `.set()` — Set the limit value of a specific `LIMIT` command. - `.upsert()` — Insert a `LIMIT` command, or update the limit value if it already exists. ### Checklist Delete any items that are not applicable to this PR. - [x] [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 ### For maintainers - [x] This was checked for breaking API changes and was [labeled appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#_add_your_labels) (cherry picked from commit 10364fb)
💚 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] More AST mutation APIs (#196240)](#196240) <!--- Backport version: 9.4.3 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Vadim Kibana","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-10-15T15:45:03Z","message":"[ES|QL] More AST mutation APIs (#196240)\n\n## Summary\r\n\r\nPartially addresses https://github.com/elastic/kibana/issues/191812\r\n\r\nImplements the following high-level ES|QL AST manipulation methods:\r\n\r\n\r\n- `.generic`\r\n- `.appendCommandArgument()` — Add a new main command argument to\r\na command.\r\n- `.removeCommandArgument()` — Remove a command argument from the\r\nAST.\r\n- `.commands`\r\n - `.from`\r\n - `.sources`\r\n - `.list()` — List all `FROM` sources.\r\n - `.find()` — Find a source by name.\r\n - `.remove()` — Remove a source by name.\r\n - `.insert()` — Insert a source.\r\n - `.upsert()` — Insert a source, if it does not exist.\r\n - `.limit`\r\n - `.list()` — List all `LIMIT` commands.\r\n - `.byIndex()` — Find a `LIMIT` command by index.\r\n - `.find()` — Find a `LIMIT` command by a predicate function.\r\n - `.remove()` — Remove a `LIMIT` command by index.\r\n- `.set()` — Set the limit value of a specific `LIMIT` command.\r\n- `.upsert()` — Insert a `LIMIT` command, or update the limit\r\nvalue if it already exists.\r\n\r\n\r\n### Checklist\r\n\r\nDelete any items that are not applicable to this PR.\r\n\r\n- [x]\r\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\r\nwas added for features that require explanation or tutorials\r\n- [x] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios\r\n\r\n### For maintainers\r\n\r\n- [x] This was checked for breaking API changes and was [labeled\r\nappropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#_add_your_labels)","sha":"10364fba2db8bb2080a97173c76a9d1aef1e80ed","branchLabelMapping":{"^v9.0.0$":"main","^v8.16.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["review","release_note:skip","v9.0.0","backport:prev-minor","Feature:ES|QL","Team:ESQL","v8.16.0"],"title":"[ES|QL] More AST mutation APIs","number":196240,"url":"https://github.com/elastic/kibana/pull/196240","mergeCommit":{"message":"[ES|QL] More AST mutation APIs (#196240)\n\n## Summary\r\n\r\nPartially addresses https://github.com/elastic/kibana/issues/191812\r\n\r\nImplements the following high-level ES|QL AST manipulation methods:\r\n\r\n\r\n- `.generic`\r\n- `.appendCommandArgument()` — Add a new main command argument to\r\na command.\r\n- `.removeCommandArgument()` — Remove a command argument from the\r\nAST.\r\n- `.commands`\r\n - `.from`\r\n - `.sources`\r\n - `.list()` — List all `FROM` sources.\r\n - `.find()` — Find a source by name.\r\n - `.remove()` — Remove a source by name.\r\n - `.insert()` — Insert a source.\r\n - `.upsert()` — Insert a source, if it does not exist.\r\n - `.limit`\r\n - `.list()` — List all `LIMIT` commands.\r\n - `.byIndex()` — Find a `LIMIT` command by index.\r\n - `.find()` — Find a `LIMIT` command by a predicate function.\r\n - `.remove()` — Remove a `LIMIT` command by index.\r\n- `.set()` — Set the limit value of a specific `LIMIT` command.\r\n- `.upsert()` — Insert a `LIMIT` command, or update the limit\r\nvalue if it already exists.\r\n\r\n\r\n### Checklist\r\n\r\nDelete any items that are not applicable to this PR.\r\n\r\n- [x]\r\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\r\nwas added for features that require explanation or tutorials\r\n- [x] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios\r\n\r\n### For maintainers\r\n\r\n- [x] This was checked for breaking API changes and was [labeled\r\nappropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#_add_your_labels)","sha":"10364fba2db8bb2080a97173c76a9d1aef1e80ed"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/196240","number":196240,"mergeCommit":{"message":"[ES|QL] More AST mutation APIs (#196240)\n\n## Summary\r\n\r\nPartially addresses https://github.com/elastic/kibana/issues/191812\r\n\r\nImplements the following high-level ES|QL AST manipulation methods:\r\n\r\n\r\n- `.generic`\r\n- `.appendCommandArgument()` — Add a new main command argument to\r\na command.\r\n- `.removeCommandArgument()` — Remove a command argument from the\r\nAST.\r\n- `.commands`\r\n - `.from`\r\n - `.sources`\r\n - `.list()` — List all `FROM` sources.\r\n - `.find()` — Find a source by name.\r\n - `.remove()` — Remove a source by name.\r\n - `.insert()` — Insert a source.\r\n - `.upsert()` — Insert a source, if it does not exist.\r\n - `.limit`\r\n - `.list()` — List all `LIMIT` commands.\r\n - `.byIndex()` — Find a `LIMIT` command by index.\r\n - `.find()` — Find a `LIMIT` command by a predicate function.\r\n - `.remove()` — Remove a `LIMIT` command by index.\r\n- `.set()` — Set the limit value of a specific `LIMIT` command.\r\n- `.upsert()` — Insert a `LIMIT` command, or update the limit\r\nvalue if it already exists.\r\n\r\n\r\n### Checklist\r\n\r\nDelete any items that are not applicable to this PR.\r\n\r\n- [x]\r\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\r\nwas added for features that require explanation or tutorials\r\n- [x] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios\r\n\r\n### For maintainers\r\n\r\n- [x] This was checked for breaking API changes and was [labeled\r\nappropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#_add_your_labels)","sha":"10364fba2db8bb2080a97173c76a9d1aef1e80ed"}},{"branch":"8.x","label":"v8.16.0","branchLabelMappingKey":"^v8.16.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Vadim Kibana <[email protected]>
Summary
Partially addresses #191812
Implements the following high-level ES|QL AST manipulation methods:
.generic
.appendCommandArgument()
— Add a new main command argument to a command..removeCommandArgument()
— Remove a command argument from the AST..commands
.from
.sources
.list()
— List allFROM
sources..find()
— Find a source by name..remove()
— Remove a source by name..insert()
— Insert a source..upsert()
— Insert a source, if it does not exist..limit
.list()
— List allLIMIT
commands..byIndex()
— Find aLIMIT
command by index..find()
— Find aLIMIT
command by a predicate function..remove()
— Remove aLIMIT
command by index..set()
— Set the limit value of a specificLIMIT
command..upsert()
— Insert aLIMIT
command, or update the limit value if it already exists.Checklist
Delete any items that are not applicable to this PR.
For maintainers