test: add date_trunc DST regression test in non-UTC session timezone#4040
Merged
parthchandra merged 2 commits intoapache:mainfrom Apr 23, 2026
Merged
test: add date_trunc DST regression test in non-UTC session timezone#4040parthchandra merged 2 commits intoapache:mainfrom
parthchandra merged 2 commits intoapache:mainfrom
Conversation
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.
3 tasks
| CREATE TABLE test_trunc_dst(ts timestamp) USING parquet | ||
|
|
||
| statement | ||
| INSERT INTO test_trunc_dst VALUES |
Contributor
There was a problem hiding this comment.
Claude suggests adding '2024-11-03 01:30:00' as a test date. The suspicion is that truncating to HOUR produces 1:00 AM, which is ambiguous on Nov 3 (it occurs in both PDT and PST). chrono's .single() returns None, causing the unwrap() to panic.
Member
Author
There was a problem hiding this comment.
I added a separate test file for this case, confirming the current panic
…k time
Adds a separate SQL test file exercising date_trunc with
timestamp('2024-11-03 01:30:00') in America/Los_Angeles. Truncating this
timestamp produces an ambiguous local time (1:00 AM occurs in both PDT
and PST), causing chrono to return None and the native kernel to panic.
All queries are marked ignore until the Rust code is fixed.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
parthchandra
approved these changes
Apr 23, 2026
Contributor
|
Merged. Thank you @andygrove |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which issue does this PR close?
Rationale for this change
Comet's native
date_truncis currently markedIncompatiblefor non-UTC session timezones and falls back to Spark by default. When a user opts into the native path viaspark.comet.expression.TruncTimestamp.allowIncompatible=true, there is no SQL-level regression coverage that exercises DST transition boundaries. This gap makes it easy for well-intentioned DST-related changes in the Rust kernel to introduce subtle correctness regressions that CI will not catch.What changes are included in this PR?
Adds one SQL file-based test:
spark/src/test/resources/sql-tests/expressions/datetime/trunc_timestamp_dst.sql.The file sets the session timezone to
America/Los_Angeles, enablesallowIncompatibleforTruncTimestamp, and runsdate_truncat every supported level (DAY, HOUR, WEEK, MONTH, QUARTER, YEAR) against a small table that includes the 2024 spring-forward day (March 10), the 2024 fall-back day (November 3), and baseline non-DST days.How are these changes tested?
The test itself is the change. Run it with:
On current
main, the test passes, verifying that the existing nativedate_truncimplementation matches Spark across the full DST matrix.