ESQL: Timezone support in DATE_TRUNC, BUCKET and TBUCKET#137450
ESQL: Timezone support in DATE_TRUNC, BUCKET and TBUCKET#137450ivancea merged 67 commits intoelastic:mainfrom
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.
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.
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. |
|
@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!