You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@arrow.apache.org by "Joris Van den Bossche (Jira)" <ji...@apache.org> on 2019/10/03 13:42:00 UTC

[jira] [Created] (ARROW-6779) [Python] Conversion from datetime.datetime to timstamp('ns') can overflow

Joris Van den Bossche created ARROW-6779:
--------------------------------------------

             Summary: [Python] Conversion from datetime.datetime to timstamp('ns') can overflow
                 Key: ARROW-6779
                 URL: https://issues.apache.org/jira/browse/ARROW-6779
             Project: Apache Arrow
          Issue Type: Improvement
          Components: Python
            Reporter: Joris Van den Bossche


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

{code}
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
]
{code}

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.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)