waitingkuo commented on code in PR #3016:
URL: https://github.com/apache/arrow-rs/pull/3016#discussion_r1017800310
##########
arrow-cast/src/cast.rs:
##########
@@ -4090,6 +4291,160 @@ mod tests {
assert!(c.is_null(2));
}
+ #[test]
+ fn test_cast_timestamp_to_time64() {
+ // test timestamp secs
+ let a = TimestampSecondArray::from(vec![Some(86405), Some(1), None])
+ .with_timezone("+01:00".to_string());
+ let array = Arc::new(a) as ArrayRef;
+ let b = cast(&array,
&DataType::Time64(TimeUnit::Microsecond)).unwrap();
+ let c = b.as_any().downcast_ref::<Time64MicrosecondArray>().unwrap();
+ assert_eq!(3605000000, c.value(0));
+ assert_eq!(3601000000, c.value(1));
+ assert!(c.is_null(2));
+ let b = cast(&array, &DataType::Time64(TimeUnit::Nanosecond)).unwrap();
+ let c = b.as_any().downcast_ref::<Time64NanosecondArray>().unwrap();
+ assert_eq!(3605000000000, c.value(0));
+ assert_eq!(3601000000000, c.value(1));
+ assert!(c.is_null(2));
Review Comment:
according to this test cases, i think the behavior now is
casting `timestamptz 1970-01-01T00:00:01+01:00` to `time64`
becomes `01:00:01`
--
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]