mbutrovich commented on issue #11592:
URL: https://github.com/apache/arrow-rs/issues/11592#issuecomment-6202202994
#11601 found the same bug and adds a case for the fix: with a time zone,
`Timestamp -> Date32` gives the local date, so flooring the UTC milliseconds
would still differ from it.
```rust
use arrow_array::cast::AsArray;
use arrow_array::types::{Date32Type, Date64Type};
use arrow_array::TimestampSecondArray;
use arrow_cast::cast;
use arrow_schema::DataType;
// 1970-01-01T00:00:01Z and 1970-01-01T20:00:00Z, which are 1969-12-31 and
1970-01-01 in -05:00
let ts = TimestampSecondArray::from(vec![1, 72_000]).with_timezone("-05:00");
let d64 = cast(&ts, &DataType::Date64).unwrap();
let d32 = cast(&ts, &DataType::Date32).unwrap();
println!("{:?}", d64.as_primitive::<Date64Type>().values()); // [1000,
72000000]
println!("{:?}", d32.as_primitive::<Date32Type>().values()); // [-1, 0]
```
Should the expected `Date64` here be `[-86400000, 0]`, the `Date32` dates in
milliseconds? I'll close #11601 as a duplicate of this issue.
--
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]