-
Notifications
You must be signed in to change notification settings - Fork 25.1k
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: Support ::date
in inline cast
#123460
ES|QL: Support ::date
in inline cast
#123460
Conversation
Pinging @elastic/es-analytical-engine (Team:Analytics) |
buildkite test this |
Pinging @elastic/kibana-esql (ES|QL-ui) |
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.
Thank you for contributing to Elasticsearch @kanoshiou ! I added some comments around the new tests.
@@ -74,6 +74,15 @@ ROW date="1985-01-01T00:00:00Z"::datetime, zero=0::datetime | |||
1985-01-01T00:00:00.000Z|1970-01-01T00:00:00.000Z | |||
; | |||
|
|||
convertToDate | |||
required_capability: casting_operator |
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.
We'll need a new entry in EsqlCapabilities
for ::date
's tests, as the older versions don't recognize ::date
.
And can we add more tests for ::date
? A date
field can appear in a lot of places of a query, there are some queries with ::datetime
used with +
and -
can be used as references, it can be used in eval
, where
etc.
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.
I initially thought it was sufficient to test only the basic casting functionality, as ::date
utilizes the same function as ::datetime
.
However, you are absolutely right—there’s no guarantee that this situation will remain unchanged forever. Therefore, adding additional tests is essential.
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.
Thank you for addressing the comments @kanoshiou! It looks pretty good to me.
Thank you for reviewing @fang-xing-esql! I have updated the test, please take another look when you have the time. |
buildkite test this |
buildkite test this |
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.
LGTM, thank you @kanoshiou!
💔 Backport failed
You can use sqren/backport to manually backport by running |
💚 All backports created successfully
Questions ?Please refer to the Backport tool documentation |
* Inline cast to date * Update docs/changelog/123460.yaml * New capability for `::date` casting * More tests * Update tests --------- Co-authored-by: Fang Xing <155562079+fang-xing-esql@users.noreply.github.com> (cherry picked from commit deff3df) # Conflicts: # x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/action/EsqlCapabilities.java Co-authored-by: kanoshiou <73424326+kanoshiou@users.noreply.github.com>
* Inline cast to date * Update docs/changelog/123460.yaml * New capability for `::date` casting * More tests * Update tests --------- Co-authored-by: Fang Xing <155562079+fang-xing-esql@users.noreply.github.com>
* Inline cast to date * Update docs/changelog/123460.yaml * New capability for `::date` casting * More tests * Update tests --------- Co-authored-by: Fang Xing <155562079+fang-xing-esql@users.noreply.github.com>
Closes #116746