Skip to content

test: add date_trunc DST regression test#3

Open
andygrove wants to merge 3 commits into
parthchandra:complete_ntzfrom
andygrove:andygrove/trunc-timestamp-dst-test
Open

test: add date_trunc DST regression test#3
andygrove wants to merge 3 commits into
parthchandra:complete_ntzfrom
andygrove:andygrove/trunc-timestamp-dst-test

Conversation

@andygrove

Copy link
Copy Markdown

Adds a SQL file-based test that exercises date_trunc natively on a DST-observing session timezone (America/Los_Angeles) with spark.comet.expression.TruncTimestamp.allowIncompatible=true. It covers both DST transition days (2024-03-10 spring-forward, 2024-11-03 fall-back) along with non-DST baseline days, and all supported truncation levels.

Running this test against the current branch shows the native result diverging from Spark on DST days for DAY truncation. Example from a local run:

                       Spark                     Comet (this branch)
[2024-03-10 05:30]     2024-03-10 00:00    !=    2024-03-09 23:00
[2024-03-10 12:30]     2024-03-10 00:00    !=    2024-03-09 23:00
[2024-07-15 10:00]     2024-07-15 00:00    ==    2024-07-15 00:00
[2024-11-03 06:30]     2024-11-03 00:00    !=    2024-11-03 01:00
[2024-11-03 14:30]     2024-11-03 00:00    !=    2024-11-03 01:00
[2024-11-15 12:00]     2024-11-15 00:00    ==    2024-11-15 00:00
[2024-12-15 23:30]     2024-12-15 00:00    ==    2024-12-15 00:00

The test is intended to pin down the DST behaviour of the as_micros_from_unix_epoch_utc change so it can be iterated on before merging.

Run with:

./mvnw test -Dsuites='org.apache.comet.CometSqlFileTestSuite trunc_timestamp_dst' -Dtest=none

Exercises CometTruncTimestamp natively (via allowIncompatible=true) with a
session timezone that observes DST. Covers spring-forward and fall-back
transition days across DAY, HOUR, WEEK, MONTH, QUARTER, and YEAR levels,
plus baseline non-DST days.
@parthchandra parthchandra force-pushed the complete_ntz branch 2 times, most recently from 85c31e8 to aebca12 Compare April 23, 2026 23:45
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.

1 participant