Skip to content

Unable to debug print large Timestamp(TimeUnit::Microsecond) values #7287

@mbutrovich

Description

@mbutrovich

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions