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] Introduce unary expressions #196817

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

vadimkibana
Copy link
Contributor

@vadimkibana vadimkibana commented Oct 18, 2024

Summary

Closes #189258

Checklist

Delete any items that are not applicable to this PR.

Risk Matrix

Delete this section if it is not applicable to this PR.

Before closing this PR, invite QA, stakeholders, and other developers to identify risks that should be tested prior to the change/feature release.

When forming the risk matrix, consider some of the following examples and how they may potentially impact the change:

Risk Probability Severity Mitigation/Notes
Multiple Spaces—unexpected behavior in non-default Kibana Space. Low High Integration tests will verify that all features are still supported in non-default Kibana Space and when user switches between spaces.
Multiple nodes—Elasticsearch polling might have race conditions when multiple Kibana nodes are polling for the same tasks. High Low Tasks are idempotent, so executing them multiple times will not result in logical error, but will degrade performance. To test for this case we add plenty of unit tests around this logic and document manual testing procedure.
Code should gracefully handle cases when feature X or plugin Y are disabled. Medium High Unit tests will verify that any feature flag or plugin combination still results in our service operational.
See more potential risk examples

For maintainers

@elasticmachine
Copy link
Contributor

🤖 Jobs for this PR can be triggered through checkboxes. 🚧

ℹ️ To trigger the CI, please tick the checkbox below 👇

  • Click to trigger kibana-pull-request for this PR!
  • Click to trigger kibana-deploy-project-from-pr for this PR!

@vadimkibana
Copy link
Contributor Author

/ci

@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 +138.0B

vadimkibana added a commit that referenced this pull request Oct 22, 2024
## Summary

Partially addresses #189258

This change will likely supercede
#196817

When parsing, currently ES|QL parsers adds extraneous multiply by 1 or
multiply by -1 nodes when parsing arithmetic unary expressions.

For example, `-(x)` is parsed as `-1 * x`.

This change, reverts these when pretty-printing using the
`BasicPrettyPrinter`: `-1 * x` is pretty printed as `-x`.


### Checklist

Delete any items that are not applicable to this PR.

- [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)
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Oct 22, 2024
…#197182)

## Summary

Partially addresses elastic#189258

This change will likely supercede
elastic#196817

When parsing, currently ES|QL parsers adds extraneous multiply by 1 or
multiply by -1 nodes when parsing arithmetic unary expressions.

For example, `-(x)` is parsed as `-1 * x`.

This change, reverts these when pretty-printing using the
`BasicPrettyPrinter`: `-1 * x` is pretty printed as `-x`.

### Checklist

Delete any items that are not applicable to this PR.

- [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 848c9f4)
stratoula pushed a commit that referenced this pull request Oct 23, 2024
…197182) (#197318)

# Backport

This will backport the following commits from `main` to `8.x`:
- [[ES|QL] Normalize multiplication by one when pretty-printing
(#197182)](#197182)

<!--- 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-22T18:05:09Z","message":"[ES|QL]
Normalize multiplication by one when pretty-printing (#197182)\n\n##
Summary\r\n\r\nPartially addresses
https://github.com/elastic/kibana/issues/189258\r\n\r\nThis change will
likely
supercede\r\nhttps://github.com//pull/196817\r\n\r\nWhen
parsing, currently ES|QL parsers adds extraneous multiply by 1
or\r\nmultiply by -1 nodes when parsing arithmetic unary
expressions.\r\n\r\nFor example, `-(x)` is parsed as `-1 *
x`.\r\n\r\nThis change, reverts these when pretty-printing using
the\r\n`BasicPrettyPrinter`: `-1 * x` is pretty printed as
`-x`.\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] [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\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":"848c9f48dc101744c8fae69951916dc511dfdc8a","branchLabelMapping":{"^v9.0.0$":"main","^v8.17.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.17.0"],"title":"[ES|QL]
Normalize multiplication by one when
pretty-printing","number":197182,"url":"https://github.com/elastic/kibana/pull/197182","mergeCommit":{"message":"[ES|QL]
Normalize multiplication by one when pretty-printing (#197182)\n\n##
Summary\r\n\r\nPartially addresses
https://github.com/elastic/kibana/issues/189258\r\n\r\nThis change will
likely
supercede\r\nhttps://github.com//pull/196817\r\n\r\nWhen
parsing, currently ES|QL parsers adds extraneous multiply by 1
or\r\nmultiply by -1 nodes when parsing arithmetic unary
expressions.\r\n\r\nFor example, `-(x)` is parsed as `-1 *
x`.\r\n\r\nThis change, reverts these when pretty-printing using
the\r\n`BasicPrettyPrinter`: `-1 * x` is pretty printed as
`-x`.\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] [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\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":"848c9f48dc101744c8fae69951916dc511dfdc8a"}},"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/197182","number":197182,"mergeCommit":{"message":"[ES|QL]
Normalize multiplication by one when pretty-printing (#197182)\n\n##
Summary\r\n\r\nPartially addresses
https://github.com/elastic/kibana/issues/189258\r\n\r\nThis change will
likely
supercede\r\nhttps://github.com//pull/196817\r\n\r\nWhen
parsing, currently ES|QL parsers adds extraneous multiply by 1
or\r\nmultiply by -1 nodes when parsing arithmetic unary
expressions.\r\n\r\nFor example, `-(x)` is parsed as `-1 *
x`.\r\n\r\nThis change, reverts these when pretty-printing using
the\r\n`BasicPrettyPrinter`: `-1 * x` is pretty printed as
`-x`.\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] [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\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":"848c9f48dc101744c8fae69951916dc511dfdc8a"}},{"branch":"8.x","label":"v8.17.0","branchLabelMappingKey":"^v8.17.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Vadim Kibana <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[ES|QL] Improve arithmetic unary expression nodes
2 participants