tustvold commented on code in PR #4323: URL: https://github.com/apache/arrow-rs/pull/4323#discussion_r1211898332
########## arrow-cast/src/cast.rs: ########## @@ -9172,4 +9172,46 @@ mod tests { ); assert!(casted_array.is_err()); } + + #[test] + fn test_cast_below_unixtimestamp() { + let valid = StringArray::from(vec![ + "1900-01-03 23:59:59", + "1969-12-31 00:00:01", + "1989-12-31 00:00:01", + ]); + + let array = Arc::new(valid) as ArrayRef; + let casted_array = cast_with_options( + &array, + &DataType::Timestamp(TimeUnit::Nanosecond, Some("+00:00".into())), + &CastOptions { + safe: false, + format_options: FormatOptions::default(), + }, + ) + .unwrap(); + + let ts_array = casted_array + .as_any() + .downcast_ref::<TimestampNanosecondArray>() + .unwrap(); Review Comment: ```suggestion let ts_array = casted_array.as_primitive::<TimestampNanosecondType>(); ``` -- 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-unsubscr...@arrow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org