hsdfat opened a new pull request, #12102: URL: https://github.com/apache/arrow-rs/pull/12102
# Which issue does this PR close? - Closes #11698 # Rationale for this change With the default format, a timestamp with a timezone is written with `to_rfc3339_opts`. RFC 3339 offsets have minute precision, so for zones whose offset has seconds (LMT offsets from tzdb such as Africa/Monrovia's `-00:44:30` before 1972, or Europe/Paris before 1911) the offset is rounded while the wall time uses the exact offset. The written string then points to an instant up to 30 s away from the stored one. # What changes are included in this PR? In `write_timestamp`, when the default format is used and the offset is not a whole number of minutes, the instant is written in UTC with a `Z` suffix. Writing the offset with seconds (`-00:44:30`) would also be lossless, but arrow's own parser (`parse_fixed_offset`) only accepts `±HH:MM`, `±HHMM` and `±HH`, so that output wouldn't read back through arrow-csv/arrow-json. Whole-minute offsets and custom formats are unchanged. # Are these changes tested? Yes. `test_timestamp_tz_offset_with_seconds` formats Africa/Monrovia (1960) and Europe/Paris (1900) timestamps and checks they parse back to the same instant, and checks that Asia/Kolkata still prints `+05:30`. # Are there any significant user-facing changes? Timestamps in zones with second-level offsets are now written with `Z` instead of a rounded offset when the default format is used. --- AI disclosure: the patch and test were drafted with AI assistance (Claude); I reviewed every line, checked the rounding against the parser's accepted offset forms, and ran fmt/clippy and the arrow-cast, arrow-csv and arrow-json tests. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
