You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@arrow.apache.org by "Wes McKinney (Jira)" <ji...@apache.org> on 2021/02/20 20:50:00 UTC

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

     [ https://issues.apache.org/jira/browse/ARROW-6779?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Wes McKinney updated ARROW-6779:
--------------------------------
    Fix Version/s: 4.0.0

> [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
>            Priority: Major
>             Fix For: 4.0.0
>
>
> 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)