Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

functions in temporal_conversions do not handle negative integers correctly #593

Closed
Tracked by #3148
mhseiden opened this issue Jul 22, 2021 · 2 comments
Closed
Tracked by #3148
Labels

Comments

@mhseiden
Copy link

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.

@mhseiden mhseiden added the bug label Jul 22, 2021
@FauxFaux
Copy link

Semi-related; these functions probably shouldn't panic at all?

In my case, an invalid (too big) Time value (was supposed to be a Timestamp) caused a ("production") panic.

@Jefffrey
Copy link
Contributor

Jefffrey commented Dec 9, 2022

Resolved by #2326

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants