Skip to content

[ES|QL] Fix validation on string implicit casting for dates and other minor issues#181571

Merged
stratoula merged 3 commits intoelastic:mainfrom
dej611:fix/esql-string-casted-as-dates
Apr 25, 2024
Merged

[ES|QL] Fix validation on string implicit casting for dates and other minor issues#181571
stratoula merged 3 commits intoelastic:mainfrom
dej611:fix/esql-string-casted-as-dates

Conversation

@dej611
Copy link
Copy Markdown
Contributor

@dej611 dej611 commented Apr 24, 2024

Summary

Fixes validation for these scenarios where literal strings are implicit casted to the other type by ES:

from index | where "2022" == now()
from index | where "2022" == 42

Also, it solves a bug that let two dates being added/diff each other, like eval now() - now().

Checklist

@dej611 dej611 added release_note:fix backport:prev-minor Feature:ES|QL ES|QL related features in Kibana v8.14.0 Team:ESQL ES|QL related features in Kibana t// v8.15.0 labels Apr 24, 2024
@dej611
Copy link
Copy Markdown
Contributor Author

dej611 commented Apr 24, 2024

/ci

@dej611 dej611 marked this pull request as ready for review April 24, 2024 16:02
@dej611 dej611 requested a review from a team as a code owner April 24, 2024 16:02
@elasticmachine
Copy link
Copy Markdown
Contributor

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

@stratoula
Copy link
Copy Markdown
Contributor

/ci

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.

Fantastic, LGTM!

@kibana-ci
Copy link
Copy Markdown

💚 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 2.9MB 2.9MB +220.0B

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@stratoula stratoula merged commit cf8a7fa into elastic:main Apr 25, 2024
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Apr 25, 2024
… minor issues (elastic#181571)

## Summary

Fixes validation for these scenarios where literal `string`s are
implicit casted to the other type by ES:

```
from index | where "2022" == now()
from index | where "2022" == 42
```

Also, it solves a bug that let two dates being added/diff each other,
like `eval now() - now()`.

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

---------

Co-authored-by: Stratoula Kalafateli <efstratia.kalafateli@elastic.co>
(cherry picked from commit cf8a7fa)
@kibanamachine
Copy link
Copy Markdown
Contributor

💚 All backports created successfully

Status Branch Result
8.14

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 25, 2024
…d other minor issues (#181571) (#181669)

# Backport

This will backport the following commits from `main` to `8.14`:
- [[ES|QL] Fix validation on string implicit casting for dates and other
minor issues (#181571)](#181571)

<!--- Backport version: 9.4.3 -->

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

<!--BACKPORT [{"author":{"name":"Marco
Liberati","email":"dej611@users.noreply.github.com"},"sourceCommit":{"committedDate":"2024-04-25T09:06:34Z","message":"[ES|QL]
Fix validation on string implicit casting for dates and other minor
issues (#181571)\n\n## Summary\r\n\r\nFixes validation for these
scenarios where literal `string`s are\r\nimplicit casted to the other
type by ES:\r\n\r\n```\r\nfrom index | where \"2022\" == now()\r\nfrom
index | where \"2022\" == 42\r\n```\r\n\r\nAlso, it solves a bug that
let two dates being added/diff each other,\r\nlike `eval now() -
now()`.\r\n\r\n\r\n### Checklist\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\r\nCo-authored-by: Stratoula Kalafateli
<efstratia.kalafateli@elastic.co>","sha":"cf8a7fa94b436f2f6c378a88410ce451cf641287","branchLabelMapping":{"^v8.15.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","backport:prev-minor","Feature:ES|QL","v8.14.0","Team:ESQL","v8.15.0"],"title":"[ES|QL]
Fix validation on string implicit casting for dates and other minor
issues","number":181571,"url":"https://github.com/elastic/kibana/pull/181571","mergeCommit":{"message":"[ES|QL]
Fix validation on string implicit casting for dates and other minor
issues (#181571)\n\n## Summary\r\n\r\nFixes validation for these
scenarios where literal `string`s are\r\nimplicit casted to the other
type by ES:\r\n\r\n```\r\nfrom index | where \"2022\" == now()\r\nfrom
index | where \"2022\" == 42\r\n```\r\n\r\nAlso, it solves a bug that
let two dates being added/diff each other,\r\nlike `eval now() -
now()`.\r\n\r\n\r\n### Checklist\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\r\nCo-authored-by: Stratoula Kalafateli
<efstratia.kalafateli@elastic.co>","sha":"cf8a7fa94b436f2f6c378a88410ce451cf641287"}},"sourceBranch":"main","suggestedTargetBranches":["8.14"],"targetPullRequestStates":[{"branch":"8.14","label":"v8.14.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.15.0","branchLabelMappingKey":"^v8.15.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/181571","number":181571,"mergeCommit":{"message":"[ES|QL]
Fix validation on string implicit casting for dates and other minor
issues (#181571)\n\n## Summary\r\n\r\nFixes validation for these
scenarios where literal `string`s are\r\nimplicit casted to the other
type by ES:\r\n\r\n```\r\nfrom index | where \"2022\" == now()\r\nfrom
index | where \"2022\" == 42\r\n```\r\n\r\nAlso, it solves a bug that
let two dates being added/diff each other,\r\nlike `eval now() -
now()`.\r\n\r\n\r\n### Checklist\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\r\nCo-authored-by: Stratoula Kalafateli
<efstratia.kalafateli@elastic.co>","sha":"cf8a7fa94b436f2f6c378a88410ce451cf641287"}}]}]
BACKPORT-->

Co-authored-by: Marco Liberati <dej611@users.noreply.github.com>
kpatticha pushed a commit to kpatticha/kibana that referenced this pull request Apr 26, 2024
… minor issues (elastic#181571)

## Summary

Fixes validation for these scenarios where literal `string`s are
implicit casted to the other type by ES:

```
from index | where "2022" == now()
from index | where "2022" == 42
```

Also, it solves a bug that let two dates being added/diff each other,
like `eval now() - now()`.


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

---------

Co-authored-by: Stratoula Kalafateli <efstratia.kalafateli@elastic.co>
@drewdaemon
Copy link
Copy Markdown
Contributor

Linking with the originating Elasticsearch PR: elastic/elasticsearch#106932

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Feature:ES|QL ES|QL related features in Kibana release_note:fix Team:ESQL ES|QL related features in Kibana t// v8.14.0 v8.15.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants