Skip to content

functions in temporal_conversions do not handle negative integers correctly #593

Description

@mhseiden

Describe the bug
From my testing, it appears that functions in temporal_conversions do not handle negative integers correctly. The cast of a negative number to a u32 results in a junk value that causes chrono to panic.

To Reproduce
The following playground snippet reproduces the issue, using the code in 5.0.0. https://docs.rs/arrow/5.0.0/src/arrow/temporal_conversions.rs.html#98-105

https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=d0a2b89c4fdb666b55627d4a371f8ec8

Expected behavior
The conversion functions should handle timestamps before the epoch correctly.

Additional context
I discovered this via the Debug impl for a Timestamp column type. Other basic operations on the column w/ negative timestamps seem to work without a problem, but I haven't tested thoroughly.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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