Skip to content
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

Merged
merged 4 commits into from
Oct 15, 2024
Merged

Conversation

vadimkibana
Copy link
Contributor

@vadimkibana vadimkibana commented Oct 15, 2024

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 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.

For maintainers

@vadimkibana
Copy link
Contributor Author

/ci

@vadimkibana vadimkibana added review release_note:skip Skip the PR/issue when compiling release notes v9.0.0 backport:prev-minor Backport to (8.x) the previous minor version (i.e. one version back from main) Feature:ES|QL ES|QL related features in Kibana Team:ESQL ES|QL related features in Kibana v8.16.0 labels Oct 15, 2024
@vadimkibana vadimkibana marked this pull request as ready for review October 15, 2024 08:15
@vadimkibana vadimkibana requested a review from a team as a code owner October 15, 2024 08:15
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-esql (Team:ESQL)

Copy link
Contributor

@stratoula stratoula left a 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!

@vadimkibana vadimkibana enabled auto-merge (squash) October 15, 2024 13:49
@vadimkibana vadimkibana merged commit 10364fb into elastic:main Oct 15, 2024
24 checks passed
@kibanamachine
Copy link
Contributor

Starting backport for target branches: 8.x

https://github.com/elastic/kibana/actions/runs/11349628924

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
kbnUiSharedDeps-srcJs 3.4MB 3.4MB +2.5KB

History

kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Oct 15, 2024
## 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)
@kibanamachine
Copy link
Contributor

💚 All backports created successfully

Status Branch Result
8.x

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

kibanamachine added a commit that referenced this pull request Oct 15, 2024
# 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":"82822460+vadimkibana@users.noreply.github.com"},"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()` &mdash; Add a new main
command argument to\r\na command.\r\n- `.removeCommandArgument()`
&mdash; Remove a command argument from the\r\nAST.\r\n- `.commands`\r\n
- `.from`\r\n - `.sources`\r\n - `.list()` &mdash; List all `FROM`
sources.\r\n - `.find()` &mdash; Find a source by name.\r\n -
`.remove()` &mdash; Remove a source by name.\r\n - `.insert()` &mdash;
Insert a source.\r\n - `.upsert()` &mdash; Insert a source, if it does
not exist.\r\n - `.limit`\r\n - `.list()` &mdash; List all `LIMIT`
commands.\r\n - `.byIndex()` &mdash; Find a `LIMIT` command by
index.\r\n - `.find()` &mdash; Find a `LIMIT` command by a predicate
function.\r\n - `.remove()` &mdash; Remove a `LIMIT` command by
index.\r\n- `.set()` &mdash; Set the limit value of a specific `LIMIT`
command.\r\n- `.upsert()` &mdash; 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()` &mdash; Add a new main
command argument to\r\na command.\r\n- `.removeCommandArgument()`
&mdash; Remove a command argument from the\r\nAST.\r\n- `.commands`\r\n
- `.from`\r\n - `.sources`\r\n - `.list()` &mdash; List all `FROM`
sources.\r\n - `.find()` &mdash; Find a source by name.\r\n -
`.remove()` &mdash; Remove a source by name.\r\n - `.insert()` &mdash;
Insert a source.\r\n - `.upsert()` &mdash; Insert a source, if it does
not exist.\r\n - `.limit`\r\n - `.list()` &mdash; List all `LIMIT`
commands.\r\n - `.byIndex()` &mdash; Find a `LIMIT` command by
index.\r\n - `.find()` &mdash; Find a `LIMIT` command by a predicate
function.\r\n - `.remove()` &mdash; Remove a `LIMIT` command by
index.\r\n- `.set()` &mdash; Set the limit value of a specific `LIMIT`
command.\r\n- `.upsert()` &mdash; 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()` &mdash; Add a new main
command argument to\r\na command.\r\n- `.removeCommandArgument()`
&mdash; Remove a command argument from the\r\nAST.\r\n- `.commands`\r\n
- `.from`\r\n - `.sources`\r\n - `.list()` &mdash; List all `FROM`
sources.\r\n - `.find()` &mdash; Find a source by name.\r\n -
`.remove()` &mdash; Remove a source by name.\r\n - `.insert()` &mdash;
Insert a source.\r\n - `.upsert()` &mdash; Insert a source, if it does
not exist.\r\n - `.limit`\r\n - `.list()` &mdash; List all `LIMIT`
commands.\r\n - `.byIndex()` &mdash; Find a `LIMIT` command by
index.\r\n - `.find()` &mdash; Find a `LIMIT` command by a predicate
function.\r\n - `.remove()` &mdash; Remove a `LIMIT` command by
index.\r\n- `.set()` &mdash; Set the limit value of a specific `LIMIT`
command.\r\n- `.upsert()` &mdash; 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 <82822460+vadimkibana@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:prev-minor Backport to (8.x) the previous minor version (i.e. one version back from main) Feature:ES|QL ES|QL related features in Kibana release_note:skip Skip the PR/issue when compiling release notes review Team:ESQL ES|QL related features in Kibana v8.16.0 v9.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants