Repository navigation
Conversation
|
@kevinjqliu when you have a chance, could you please take a look at this pr and let me know if any update is needed? |
Fokko
left a comment
There was a problem hiding this comment.
Thanks for tackling this!
The description says the fixed 9-digit output "matches the Java DateTimeUtil.nanosToIsoTimestamp behavior… with no trailing-zero trimming", but Java actually does the opposite. It trims trailing zeros (and drops the fraction entirely for a whole second). nanosToIsoTimestamp formats via DateTimeFormatter.ISO_LOCAL_DATE_TIME, whose appendFraction(NANO_OF_SECOND, 0, 9, true) omits trailing zeros.
There was a problem hiding this comment.
🟢 Approval recommended
No unresolved blocking issues were identified.
Pull request overview
Fixes ISO-8601 formatting for identity-partitioned nanosecond timestamps.
Changes:
- Adds nanosecond timestamp formatting helpers.
- Registers handlers for nanosecond timestamp types.
- Adds unit and partition-path coverage.
File summaries
| File | Description |
|---|---|
tests/utils/test_datetime.py |
Tests nanosecond formatting edge cases. |
tests/test_transforms.py |
Tests identity transform output. |
tests/table/test_partitioning.py |
Tests generated partition paths. |
pyiceberg/utils/datetime.py |
Adds nanosecond ISO formatting. |
pyiceberg/transforms.py |
Registers nanosecond type handlers. |
Review details
- Files reviewed: 5/5 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
This pull request has been marked as stale due to 30 days of inactivity. It will be closed in 1 week if no further activity occurs. If you think that's incorrect or this pull request requires a review, please simply write any comment. If closed, you can revive the PR at any time and @mention a reviewer or discuss it on the dev@iceberg.apache.org list. Thank you for your contributions. |
|
This pull request has been marked as stale due to 30 days of inactivity. It will be closed in 1 week if no further activity occurs. If you think that's incorrect or this pull request requires a review, please simply write any comment. If closed, you can revive the PR at any time and @mention a reviewer or discuss it on the dev@iceberg.apache.org list. Thank you for your contributions. |
Identity transforms on timestamp_ns and timestamptz_ns rendered raw integers instead of ISO-8601 partition directory values. Add integer-only nanosecond formatters and register both timestamp types. Preserve nanosecond precision while trimming trailing fractional zeros and omitting the fraction for whole seconds, matching Java DateTimeUtil. Use the explicit +00:00 offset for timezone-aware values. Signed-off-by: Anas Khan <83116240+anxkhn@users.noreply.github.com>
Rationale for this change
Identity transforms render
timestamp_nsandtimestamptz_nspartition valuesas raw integers because neither type is registered with the human-string
formatter.
Register both types and add integer-only nanosecond formatters. Fractional
trailing zeros are trimmed, whole seconds have no fraction, and timezone-aware
values use
+00:00. This matches Java'sDateTimeUtil.nanosToIsoTimestampandnanosToIsoTimestamptz. The earlier fixed-nine-digit description was incorrect.Are these changes tested?
make lintpasses, including mypy, Ruff, codespell, and lockfile validation.make testpasses the full unit suite.nanosecond precision, negative timestamps, and UTC offsets.
existing microsecond types.
Docker/Spark integration tests were not run locally.
Are there any user-facing changes?
Yes. Human strings and identity partition paths for nanosecond timestamp columns
now contain ISO-8601 timestamps rather than raw integers.
This update was prepared with AI assistance through OpenCode and independently
source-reviewed by Opus 5.5 and Gemini 4 Neon. Those reviews are not maintainer
approvals.