Skip to content

[ES|QL] Source AST node parsing improvements and source selector parsing#217299

Merged
stratoula merged 2 commits into
elastic:mainfrom
vadimkibana:esql-source-parsing
Apr 7, 2025
Merged

[ES|QL] Source AST node parsing improvements and source selector parsing#217299
stratoula merged 2 commits into
elastic:mainfrom
vadimkibana:esql-source-parsing

Conversation

@vadimkibana
Copy link
Copy Markdown
Contributor

@vadimkibana vadimkibana commented Apr 7, 2025

Summary

  • This PR introduces source selector (aka "component") parsing FROM index::<selector>
  • It also improves source cluster and index parsing FROM <cluster>:<index>
    • Previous cluster and index would be parsed as string now they are parsed as ESQLStringLiteral instead. This is more correct as any of those can take three forms, and ESQLStringLiteral handles all three forms:
      1. unquoted string: cluster:index
      2. single-double quoted string: "cluster":"index"
      3. triple-double quote string: """cluster""":"""index""
  • The ESQLStringLiteral now also supports "unquoted strings" in addition to single "str" and triple """str""" quoted strings.

Checklist

@vadimkibana vadimkibana requested review from a team as code owners April 7, 2025 10:12
@vadimkibana vadimkibana added review Feature:ES|QL ES|QL related features in Kibana Team:ESQL ES|QL related features in Kibana t// backport:version Backport to applied version labels v9.1.0 v8.19.0 labels Apr 7, 2025
@elasticmachine
Copy link
Copy Markdown
Contributor

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

@vadimkibana vadimkibana added the release_note:skip Skip the PR/issue when compiling release notes label Apr 7, 2025
Copy link
Copy Markdown
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.

Looks great, there is some additional work that needs to be done for the validation to work but I will follow up in another PR

@elasticmachine
Copy link
Copy Markdown
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.6MB 3.6MB +782.0B
Unknown metric groups

API count

id before after diff
@kbn/esql-ast 317 318 +1

Copy link
Copy Markdown
Contributor

@paulinashakirova paulinashakirova left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SharedUX code lgtm

@stratoula stratoula merged commit 86fdbe5 into elastic:main Apr 7, 2025
@kibanamachine
Copy link
Copy Markdown
Contributor

Starting backport for target branches: 8.x

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

kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Apr 7, 2025
…ing (elastic#217299)

## Summary

- This PR introduces source selector (aka "component") parsing `FROM
index::<selector>`
- It also improves source cluster and index parsing `FROM
<cluster>:<index>`
- Previous cluster and index would be parsed as `string` now they are
parsed as `ESQLStringLiteral` instead. This is more correct as any of
those can take three forms, and `ESQLStringLiteral` handles all three
forms:
    1. unquoted string: `cluster:index`
    2. single-double quoted string: `"cluster":"index"`
    3. triple-double quote string: `"""cluster""":"""index""`
- The `ESQLStringLiteral` now also supports *"unquoted strings"* in
addition to single `"str"` and triple `"""str"""` quoted strings.

### Checklist

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

(cherry picked from commit 86fdbe5)
@kibanamachine
Copy link
Copy Markdown
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 Apr 7, 2025
…r parsing (#217299) (#217345)

# Backport

This will backport the following commits from `main` to `8.x`:
- [[ES|QL] Source AST node parsing improvements and source selector
parsing (#217299)](#217299)

<!--- Backport version: 9.6.6 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)

<!--BACKPORT [{"author":{"name":"Vadim
Kibana","email":"82822460+vadimkibana@users.noreply.github.com"},"sourceCommit":{"committedDate":"2025-04-07T14:11:10Z","message":"[ES|QL]
Source AST node parsing improvements and source selector parsing
(#217299)\n\n## Summary\n\n- This PR introduces source selector (aka
\"component\") parsing `FROM\nindex::<selector>`\n- It also improves
source cluster and index parsing `FROM\n<cluster>:<index>`\n- Previous
cluster and index would be parsed as `string` now they are\nparsed as
`ESQLStringLiteral` instead. This is more correct as any of\nthose can
take three forms, and `ESQLStringLiteral` handles all three\nforms:\n 1.
unquoted string: `cluster:index`\n 2. single-double quoted string:
`\"cluster\":\"index\"`\n 3. triple-double quote string:
`\"\"\"cluster\"\"\":\"\"\"index\"\"`\n- The `ESQLStringLiteral` now
also supports *\"unquoted strings\"* in\naddition to single `\"str\"`
and triple `\"\"\"str\"\"\"` quoted strings.\n\n\n### Checklist\n\n- [x]
[Unit or
functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere
updated or added to match the most common
scenarios","sha":"86fdbe5379bbe43036d503752ff502fc28718f4b","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["review","release_note:skip","Feature:ES|QL","Team:ESQL","backport:version","v9.1.0","v8.19.0"],"title":"[ES|QL]
Source AST node parsing improvements and source selector
parsing","number":217299,"url":"https://github.com/elastic/kibana/pull/217299","mergeCommit":{"message":"[ES|QL]
Source AST node parsing improvements and source selector parsing
(#217299)\n\n## Summary\n\n- This PR introduces source selector (aka
\"component\") parsing `FROM\nindex::<selector>`\n- It also improves
source cluster and index parsing `FROM\n<cluster>:<index>`\n- Previous
cluster and index would be parsed as `string` now they are\nparsed as
`ESQLStringLiteral` instead. This is more correct as any of\nthose can
take three forms, and `ESQLStringLiteral` handles all three\nforms:\n 1.
unquoted string: `cluster:index`\n 2. single-double quoted string:
`\"cluster\":\"index\"`\n 3. triple-double quote string:
`\"\"\"cluster\"\"\":\"\"\"index\"\"`\n- The `ESQLStringLiteral` now
also supports *\"unquoted strings\"* in\naddition to single `\"str\"`
and triple `\"\"\"str\"\"\"` quoted strings.\n\n\n### Checklist\n\n- [x]
[Unit or
functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere
updated or added to match the most common
scenarios","sha":"86fdbe5379bbe43036d503752ff502fc28718f4b"}},"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/217299","number":217299,"mergeCommit":{"message":"[ES|QL]
Source AST node parsing improvements and source selector parsing
(#217299)\n\n## Summary\n\n- This PR introduces source selector (aka
\"component\") parsing `FROM\nindex::<selector>`\n- It also improves
source cluster and index parsing `FROM\n<cluster>:<index>`\n- Previous
cluster and index would be parsed as `string` now they are\nparsed as
`ESQLStringLiteral` instead. This is more correct as any of\nthose can
take three forms, and `ESQLStringLiteral` handles all three\nforms:\n 1.
unquoted string: `cluster:index`\n 2. single-double quoted string:
`\"cluster\":\"index\"`\n 3. triple-double quote string:
`\"\"\"cluster\"\"\":\"\"\"index\"\"`\n- The `ESQLStringLiteral` now
also supports *\"unquoted strings\"* in\naddition to single `\"str\"`
and triple `\"\"\"str\"\"\"` quoted strings.\n\n\n### Checklist\n\n- [x]
[Unit or
functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere
updated or added to match the most common
scenarios","sha":"86fdbe5379bbe43036d503752ff502fc28718f4b"}},{"branch":"8.x","label":"v8.19.0","branchLabelMappingKey":"^v8.19.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Vadim Kibana <82822460+vadimkibana@users.noreply.github.com>
baileycash-elastic pushed a commit to baileycash-elastic/kibana that referenced this pull request Apr 7, 2025
…ing (elastic#217299)

## Summary

- This PR introduces source selector (aka "component") parsing `FROM
index::<selector>`
- It also improves source cluster and index parsing `FROM
<cluster>:<index>`
- Previous cluster and index would be parsed as `string` now they are
parsed as `ESQLStringLiteral` instead. This is more correct as any of
those can take three forms, and `ESQLStringLiteral` handles all three
forms:
    1. unquoted string: `cluster:index`
    2. single-double quoted string: `"cluster":"index"`
    3. triple-double quote string: `"""cluster""":"""index""`
- The `ESQLStringLiteral` now also supports *"unquoted strings"* in
addition to single `"str"` and triple `"""str"""` quoted strings.


### Checklist

- [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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:version Backport to applied version labels 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 t// v8.19.0 v9.1.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants