-
Notifications
You must be signed in to change notification settings - Fork 25.6k
ESQL: Timezone support in DATE_TRUNC, BUCKET and TBUCKET #137450
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
Conversation
… ones that use it
# Conflicts: # x-pack/plugin/esql/qa/testFixtures/src/main/java/org/elasticsearch/xpack/esql/EsqlTestUtils.java # x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/action/EsqlCapabilities.java # x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/CsvTests.java # x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/date/DateFormatTests.java
# Conflicts: # x-pack/plugin/esql/qa/testFixtures/src/main/java/org/elasticsearch/xpack/esql/EsqlTestUtils.java
# Conflicts: # x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/EsqlFunctionRegistry.java # x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/grouping/TBucket.java
…earch into esql-datetrunc-timezone # Conflicts: # x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/date/DateTruncTests.java
bpintea
left a comment
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.
Could we add some REST tests with timezones set as JSON field / query parameter and maybe compare with another run of same query SETting it?
| /** | ||
| * Support timezones in DATE_TRUNC and dependent functions. | ||
| */ | ||
| DATE_TRUNC_TIMEZONE_SUPPORT(Build.current().isSnapshot()), |
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 guess you could also have:
| DATE_TRUNC_TIMEZONE_SUPPORT(Build.current().isSnapshot()), | |
| DATE_TRUNC_TIMEZONE_SUPPORT(SET_COMMAND.isEnabled()), |
if you want to link them. But then you could also introduce two caps, if you want to isolate the SET-related logic. Just some thoughts, it can stay as is.
...gin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/grouping/Bucket.java
Outdated
Show resolved
Hide resolved
...c/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/date/DateTruncTests.java
Outdated
Show resolved
Hide resolved
...n/esql/src/test/java/org/elasticsearch/xpack/esql/optimizer/rules/logical/FoldNullTests.java
Outdated
Show resolved
Hide resolved
|
@bpintea Tests for request/SET settings were added here, if that's what you mean: https://github.com/elastic/elasticsearch/pull/136748/files#diff-8e410478016b271c9f44f50aa2d9e5f911135694d0ac6a733e2bce7d219d23e4 Do you think that's enough, or are you thinking of some other case? Thanks! |
|
My idea was to add some
and then comparing the results. For some randomized TZs. |
luigidellaquila
left a comment
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
|
@bpintea Nice idea; just added a test comparing the setting methods (+ the bucket/date_trunc/tbucket functions for extra checks) |
Timezone settings (Both the request parameter and the SET setting) are snapshot-only.
Add timezone support to DATE_TRUNC, BUCKET and TBUCKET.
The current timezone is already in the Configuration. This PR:
For reviewers
Please take a good look at the expected results of DATE_TRUNC in
DateTruncTests, and comment any interesting or edge case you can think of!