alamb commented on a change in pull request #771:
URL: https://github.com/apache/arrow-rs/pull/771#discussion_r713251376
##########
File path: arrow/src/compute/kernels/temporal.rs
##########
@@ -294,4 +301,54 @@ mod tests {
assert!(!b.is_valid(1));
assert_eq!(7, b.value(2));
}
+
+ #[test]
+ fn test_temporal_array_timestamp_second_with_timezone() {
+ use std::sync::Arc;
+
+ let a = Arc::new(TimestampSecondArray::from_vec(
+ vec![10, 20],
+ Some("+0000".to_string()),
Review comment:
The description in the PR says
> Anything of the form [+-]XX:XX will be recognized but nothing of the form
eg America/Newyork will start returning error
However, these tests use the form `XXXX`
Is that intentional?
The arrow schema says a numeric timezone should contain a colon (`:`) I
believe; https://github.com/apache/arrow/blob/master/format/Schema.fbs#L341-L351
> An absolute timezone offset of the form "+XX:XX" or "-XX:XX",
> /// such as "+07:30".
##########
File path: arrow/src/array/array_primitive.rs
##########
@@ -232,6 +232,19 @@ where
as_datetime::<T>(i64::from(self.value(i)))
}
+ /// Returns value as a chrono `NaiveDateTime`, handling time resolution
with the provided tz
Review comment:
🤔 what do you think about making this generic so that when non fixed
timezones are supported no changes are required?
For example, perhaps something like:
```rust
pub fn value_as_datetime_with_tz<Tz: TimeZone>(
&self,
i: usize,
tz: Tz,
) -> Option<NaiveDateTime>
{
..
}
```
https://docs.rs/chrono/0.4.19/chrono/offset/trait.TimeZone.html
--
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]