waitingkuo commented on code in PR #3016:
URL: https://github.com/apache/arrow-rs/pull/3016#discussion_r1018521698
##########
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 we not yet have the consensus to do either
casting `2000-01-01T08:00:00+08:00` to Timestamp becomes
1. 2000-01-01T08:00:00 (which is what postgrseql has, also is consistent
with this pr)
2. or 2000-01-01T00:00:00 (which doesn't change the underline values, number
of seconds/milis/micros/nanos fro 1970
--
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]