miguelcorderopamphile commented on code in PR #11572:
URL: https://github.com/apache/arrow-rs/pull/11572#discussion_r4296728809


##########
arrow-cast/src/cast/mod.rs:
##########
@@ -5526,6 +5563,44 @@ mod tests {
         );
     }
 
+    #[test]
+    fn test_cast_string_to_duration() {
+        let array = StringArray::from(vec![Some("1"), Some("-2"), None, 
Some("invalid")]);

Review Comment:
   Currently numeric only: the cast reuses the existing `Duration*Type` parser 
impls (the same integer parsing the JSON reader uses).
   
   I can extend it to unit strings like `1 hour 10 minutes` by going through 
the existing string→interval parser and the `Interval(MonthDayNano) → Duration` 
cast, which keeps the current semantics (months/days are not convertible — 
`cast_month_day_nano_to_duration` nulls/errors them).
   
   I could add it in this PR or keep this one numeric-only — your call.



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