ryux1 commented on code in PR #11006:
URL: https://github.com/apache/arrow-rs/pull/11006#discussion_r3945700579


##########
arrow-cast/src/parse.rs:
##########
@@ -1653,7 +1653,19 @@ fn parse_interval_components(
     // parse amounts and units
     let Ok(pairs): Result<Vec<(IntervalAmount, IntervalUnit)>, ArrowError> = 
raw_pairs
         .iter()
-        .map(|(a, u)| Ok((a.parse()?, IntervalUnit::from_str_or_config(*u, 
config)?)))
+        .map(|(a, u)| {
+            // A unit with no preceding amount (e.g. the "hour" in "5 day 
hour")
+            // is treated as an amount of zero, matching PostgreSQL.
+            let amount = if a.is_empty() {

Review Comment:
   That guard and regression cover the scope issue I found. Thanks for 
tightening it.



-- 
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]

Reply via email to