tustvold commented on code in PR #3016:
URL: https://github.com/apache/arrow-rs/pull/3016#discussion_r1018303809
##########
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:
I think this is actually correct, the array contents are
```
"1970-01-02 01:00:05 +01:00",
"1970-01-01 01:00:01 +01:00",
null,
```
I have filed https://github.com/apache/arrow-rs/issues/3069 as this deeply
confused me.
Can you confirm @waitingkuo ?
--
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]