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

[Python] Conversion from datetime.datetime to timstamp('ns') can overflow #23116

Closed
asfimport opened this issue Oct 3, 2019 · 2 comments
Closed

Comments

@asfimport
Copy link

asfimport commented Oct 3, 2019

In the python conversion of datetime scalars, there is no check for integer overflow:

In [32]: pa.array([datetime.datetime(3000, 1, 1)], pa.timestamp('ns'))                                                                                                                                             
Out[32]: 
<pyarrow.lib.TimestampArray object at 0x7f5bddec00a8>
[
  1830-11-23 00:50:52.580896768
]

So in case the target type has nanosecond unit, this can give wrong results (I don't think the other resolutions can reach overflow, given the limited range of years of datetime.datetime).

We should probably check for this case and raise an error.

Reporter: Joris Van den Bossche / @jorisvandenbossche

Related issues:

Note: This issue was originally created as ARROW-6779. Please see the migration documentation for further details.

@asfimport
Copy link
Author

Antoine Pitrou / @pitrou:
It looks like you fixed this in ARROW-9768 :-)

@asfimport
Copy link
Author

Todd Farmer / @toddfarmer:
Transitioning issue from Resolved to Closed to based on resolution field value.

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

No branches or pull requests

1 participant