swanandx commented on code in PR #9961:
URL: https://github.com/apache/arrow-rs/pull/9961#discussion_r3279580461
##########
arrow-cast/src/parse.rs:
##########
@@ -585,6 +585,34 @@ const EPOCH_DAYS_FROM_CE: i32 = 719_163;
/// Error message if nanosecond conversion request beyond supported interval
const ERR_NANOSECONDS_NOT_SUPPORTED: &str = "The dates that can be represented
as nanoseconds have to be between 1677-09-21T00:12:44.0 and
2262-04-11T23:47:16.854775804";
+/// Parse the ISO 8601 signed extended-year form (`±YYYY[Y...]-MM-DD`) into
+/// raw `(year, month, day)` components, without validating the calendar date.
+///
+/// The leading sign is required and the year must have at least 4 digits.
+/// Returns `None` if the prefix isn't `+`/`-`, the shape is malformed, or any
+/// component fails to parse numerically.
+fn parse_extended_ymd(string: &str) -> Option<(i32, u32, u32)> {
+ if !(string.starts_with('+') || string.starts_with('-')) {
Review Comment:
I thought it would be nice in term of safety, but given that it's internal
fn and we control callsites, makes sense to make ti debug_assert, thanks!
--
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]