Skip to content

fix: [branch-0.14] backport #3865 - handle ambiguous and non-existent local times#3937

Merged
andygrove merged 3 commits intoapache:branch-0.14from
andygrove:backport-3865-to-0.14
Apr 14, 2026
Merged

fix: [branch-0.14] backport #3865 - handle ambiguous and non-existent local times#3937
andygrove merged 3 commits intoapache:branch-0.14from
andygrove:backport-3865-to-0.14

Conversation

@andygrove
Copy link
Copy Markdown
Member

@andygrove andygrove commented Apr 13, 2026

Which issue does this PR close?

Backport of #3865 to branch-0.14.

Rationale for this change

PR #3865 fixes handling of ambiguous and non-existent local times (e.g., during DST transitions) when casting TimestampNTZ to Timestamp. This resolves some panics.

What changes are included in this PR?

Cherry-pick of commit 6565de9 from main. A minor conflict in the test file was resolved (new tests appended after existing tests).

How are these changes tested?

Tests are included in the original PR and were cherry-picked along with the fix.

* fix: choose earliest time when ambiguous

* fix: handle non-existent times due to time change

* test: add unit tests for ambiguous and non-existent local times

* refactor: remove unnecessary catch_unwind in tests

* test: add spark test for timestampntz dst casting

* refactor: remove unwrap from resolve_local_datetime

---------

Co-authored-by: Matthew Alex <malex@palantir.com>
@andygrove andygrove changed the title fix: backport #3865 - handle ambiguous and non-existent local times fix: [branch-0.14] backport #3865 - handle ambiguous and non-existent local times Apr 13, 2026
The cherry-pick of apache#3865 inadvertently included Days expression tests
from apache#3746, which is not present on branch-0.14.
@andygrove
Copy link
Copy Markdown
Member Author

@matthewalex4 could you review?

Copy link
Copy Markdown
Contributor

@matthewalex4 matthewalex4 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks @andygrove.

Copy link
Copy Markdown
Contributor

@mbutrovich mbutrovich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @andygrove!

@andygrove andygrove merged commit fa84f8e into apache:branch-0.14 Apr 14, 2026
110 checks passed
@andygrove andygrove deleted the backport-3865-to-0.14 branch April 14, 2026 14:21
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.

3 participants