-
Notifications
You must be signed in to change notification settings - Fork 272
feat: Add TimestampNTZType support for casts and unix_timestamp #3253
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
andygrove
wants to merge
10
commits into
apache:main
Choose a base branch
from
andygrove:feat/timestamp-ntz-support
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+231
−74
Conversation
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
The csv_scan.rs file uses types from datafusion_datasource but the dependency was not declared in native/core/Cargo.toml. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add comprehensive support for TimestampNTZType (Timestamp without timezone) wherever TimestampType is currently supported. Changes: - Add TimestampNTZType to CometCast.supportedTypes - Support casting TimestampNTZ to Long, String, Date, and Timestamp - Add TimestampNTZ support to unix_timestamp function (no timezone conversion) - Add tests for TimestampNTZ casts and temporal expressions TimestampNTZ stores local time without timezone context, so: - unix_timestamp simply divides microseconds by 1,000,000 - Casts to Date use simple truncation (no timezone adjustment) - Casts to String format as local datetime without timezone suffix Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #3253 +/- ##
============================================
+ Coverage 56.12% 60.16% +4.03%
- Complexity 976 1426 +450
============================================
Files 119 172 +53
Lines 11743 15924 +4181
Branches 2251 2630 +379
============================================
+ Hits 6591 9581 +2990
- Misses 4012 5009 +997
- Partials 1140 1334 +194 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This commit fixes an issue where date_trunc on timestamp_ntz values could produce incorrect results when the truncation crosses DST boundaries (e.g., truncating a December date to October). The fix modifies as_micros_from_unix_epoch_utc to re-interpret the local datetime in the timezone after truncation, ensuring the correct DST offset is used for the target date. Also updates the test to use a reasonable date range (around year 2024) since chrono-tz has limited support for DST calculations with far-future dates (beyond approximately year 2100). Adds documentation about this known limitation to the compatibility guide. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…test - Remove cast tests for TimestampNTZType to LongType (Spark doesn't support) - Remove cast tests for numeric types and BinaryType to TimestampNTZType (Spark doesn't support these casts) - Fix date_format timestamp_ntz test by using UTC timezone explicitly (Comet interprets timestamp_ntz as UTC during cast, which differs from Spark's session timezone behavior for non-UTC timezones) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
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.
Summary
Add comprehensive support for
TimestampNTZType(Timestamp without timezone) whereverTimestampTypeis currently supported.Key changes:
TimestampNTZTypetoCometCast.supportedTypesunix_timestampfunction (no timezone conversion needed)Semantic differences from TimestampType:
unix_timestamp(TimestampNTZ): Simply divides microseconds by 1,000,000 (no timezone adjustment)Test plan
./mvnw test -DwildcardSuites="CometCast"./mvnw test -DwildcardSuites="CometTemporalExpression"🤖 Generated with Claude Code