Skip to content

fix: preserve the timezone in the schema when resolving output timezone - #23925

Draft
nevi-me wants to merge 1 commit into
apache:mainfrom
urbanlogiq:fix-tz-discard-to-timestamp
Draft

fix: preserve the timezone in the schema when resolving output timezone#23925
nevi-me wants to merge 1 commit into
apache:mainfrom
urbanlogiq:fix-tz-discard-to-timestamp

Conversation

@nevi-me

@nevi-me nevi-me commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

Rationale for this change

to_timestamp_millis (and the rest of the family) should not silently drop the timezone of an already-zoned input. Passing a Timestamp(_, Some("+05:00")) through the function should either:

  1. preserve the input zone, or
  2. if honoring datafusion.execution.time_zone, convert the timezone but never relabel to a naive type, which changes the wall-clock value.

What changes are included in this PR?

Restore the behaviour of preserving the input zone

Are these changes tested?

Are there any user-facing changes?

@nevi-me nevi-me changed the title Preserve the timezone in the schema when resolving output timezone fix: preserve the timezone in the schema when resolving output timezone Jul 27, 2026
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.83333% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 80.67%. Comparing base (8d2ffc9) to head (51c6d12).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
datafusion/functions/src/datetime/to_timestamp.rs 95.83% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #23925      +/-   ##
==========================================
- Coverage   80.67%   80.67%   -0.01%     
==========================================
  Files        1095     1095              
  Lines      372460   372519      +59     
  Branches   372460   372519      +59     
==========================================
+ Hits       300495   300536      +41     
- Misses      54040    54054      +14     
- Partials    17925    17929       +4     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

to_timestamp_* discards the timezone of already-timezone-aware inputs

2 participants