You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "ShivanshhhG (via GitHub)" <gi...@apache.org> on 2026/10/19 10:20:21 UTC
[PR] GH-54534: [C++] Fix truncation of sub-minute UTC offsets when formatting and parsing zoned timestamps [arrow]
ShivanshhhG opened a new pull request, #54627:
URL: https://github.com/apache/arrow/pull/54627
### Rationale for this change
When formatting zoned timestamps whose UTC offset includes sub-minute seconds (e.g. historical IANA zones such as `Africa/Monrovia` prior to 1972 at UTC-00:44:30 or `Europe/Paris` prior to 1911 at UTC+00:09:21), the vendored `date.h` library truncated the offset to whole minutes via `duration_cast<minutes>`, omitting the remaining seconds and emitting an inaccurate offset (e.g. `-0044` instead of `-004430`). When parsed back (via `Cast` or CSV reader), the timestamp instant was shifted by up to 59 seconds.
### What changes are included in this PR?
1. **`cpp/src/arrow/vendored/datetime/date.h`**:
- In `to_stream` for format specifiers `%z` and `%Ez`, check whether `*offset_sec` has non-zero seconds (`s != 0`).
- If non-zero seconds are present, emit them (`±hhmmss` for `%z` or `±hh:mm:ss` for `%Ez`). If whole minutes, retain the standard `±hhmm` / `±hh:mm` representation.
2. **`cpp/src/arrow/util/value_parsing.h`**:
- Added `detail::ParseHHMMSS` to parse 6-digit offsets with hours, minutes, and seconds.
- Updated `ParseTimestampISO8601` to recognize and parse `[+-]HHMMSS` and `[+-]HH:MM:SS` zone offsets.
3. **`cpp/src/arrow/util/value_parsing.cc` & `cpp/src/arrow/compute/kernels/scalar_temporal_unary.cc`**:
- Updated `StrptimeTimestampParser` and `GetZone` to recognize `%Ez` as providing a zone offset.
4. **Tests**:
- Added unit test cases for sub-minute offsets and invalid offsets in `cpp/src/arrow/util/value_parsing_test.cc`.
- Added regression test cases casting zoned timestamps in `Africa/Monrovia` and `Europe/Paris` to strings in `cpp/src/arrow/compute/kernels/scalar_cast_test.cc`.
### Are these changes tested?
Yes, new unit tests were added to `value_parsing_test.cc` and `scalar_cast_test.cc`.
### Are there any user-facing changes?
Yes, casting zoned timestamps with sub-minute UTC offsets to string (and exporting them to CSV) now accurately formats the offset seconds rather than truncating them, and `ParseTimestampISO8601` can parse timestamps with seconds in the UTC offset.
* GitHub Issue: #54534
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] GH-54534: [C++] Fix truncation of sub-minute UTC offsets when formatting and parsing zoned timestamps [arrow]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] closed pull request #54627: GH-54534: [C++] Fix truncation of sub-minute UTC offsets when formatting and parsing zoned timestamps
URL: https://github.com/apache/arrow/pull/54627
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] GH-54534: [C++] Fix truncation of sub-minute UTC offsets when formatting and parsing zoned timestamps [arrow]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #54627:
URL: https://github.com/apache/arrow/pull/54627#issuecomment-6264992320
:warning: GitHub issue #54534 **has been automatically assigned in GitHub** to PR creator.
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] GH-54534: [C++] Fix truncation of sub-minute UTC offsets when formatting and parsing zoned timestamps [arrow]
Posted by "ShivanshhhG (via GitHub)" <gi...@apache.org>.
ShivanshhhG commented on PR #54627:
URL: https://github.com/apache/arrow/pull/54627#issuecomment-6283949379
Closed stale PR #51133 so concurrent open PR count is now <= 3. Reopening this PR for review. Thank you!
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] GH-54534: [C++] Fix truncation of sub-minute UTC offsets when formatting and parsing zoned timestamps [arrow]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #54627:
URL: https://github.com/apache/arrow/pull/54627#issuecomment-6264991984
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
Thanks for opening a pull request!
**This pull request has been automatically closed because you currently have 4 open pull requests, which is more than the limit of 3.**
Due to the increase in pull requests opened by AI bots, and in order to keep the review queue manageable, Apache Arrow limits contributors without repository access to at most 3 concurrently open pull requests. This helps make sure each pull request gets the attention it needs and that work in progress does not go stale.
Once one of [your other open pull requests](https://github.com/apache/arrow/pulls/ShivanshhhG) has been merged or closed, you are welcome to reopen this one.
See also:
* [Contribution Guidelines - Limit on concurrent pull requests](https://arrow.apache.org/docs/dev/developers/bug_reports.html#pr-limit)
* [Contribution Guidelines - Contributing Overview](https://arrow.apache.org/docs/developers/overview.html)
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] GH-54534: [C++] Fix truncation of sub-minute UTC offsets when formatting and parsing zoned timestamps [arrow]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #54627:
URL: https://github.com/apache/arrow/pull/54627#issuecomment-6264992515
:warning: GitHub issue #54534 **has no components**, please add labels for components.
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org