Describe the bug
While working on #7285 I noticed that some non-null values of Timestamp(TimeUnit::Microsecond) print as null.
To Reproduce
Running...
let arr: PrimitiveArray<TimestampMicrosecondType> =
TimestampMicrosecondArray::from(vec![9089380393200000000]);
println!("{:?}", arr);
...results in:
PrimitiveArray<Timestamp(Microsecond, None)>
[
null,
]
Expected behavior
This is a valid 64-bit microsecond timestamp that Spark says is [290000-12-30 15:00:00.0]. I have not done the math to confirm that result yet, but it's definitely a a valid int64 so we should be able to print the resulting timestamp.
Additional context
I suspect the issue is that PrimitiveArray's fmt method coerces Timestamp to the chrono crate's datetime:
|
DataType::Timestamp(_, tz_string_opt) => { |
which far enough down the call stack clips the values to 32-bit and generate a
null.:
https://github.com/chronotope/chrono/blob/fa957cc8dcd4c5a2233108f94a287aab6dedf0a9/src/datetime/mod.rs#L747
I also suspect that other TimeUnits are affected by this issue.
Describe the bug
While working on #7285 I noticed that some non-null values of
Timestamp(TimeUnit::Microsecond)print asnull.To Reproduce
Running...
...results in:
Expected behavior
This is a valid 64-bit microsecond timestamp that Spark says is
[290000-12-30 15:00:00.0]. I have not done the math to confirm that result yet, but it's definitely a a validint64so we should be able to print the resulting timestamp.Additional context
I suspect the issue is that
PrimitiveArray'sfmtmethod coercesTimestampto the chrono crate'sdatetime:arrow-rs/arrow-array/src/array/primitive_array.rs
Line 1272 in 172d79f
which far enough down the call stack clips the values to 32-bit and generate a
null.:https://github.com/chronotope/chrono/blob/fa957cc8dcd4c5a2233108f94a287aab6dedf0a9/src/datetime/mod.rs#L747
I also suspect that other
TimeUnits are affected by this issue.