You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@arrow.apache.org by "Antoine Pitrou (JIRA)" <ji...@apache.org> on 2018/03/08 10:42:00 UTC
[jira] [Commented] (ARROW-2288) [Python] slicing logic defective
[ https://issues.apache.org/jira/browse/ARROW-2288?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16391052#comment-16391052 ]
Antoine Pitrou commented on ARROW-2288:
---------------------------------------
As for the crash: since {{Array::Slice}} adjusts the length when too large, it would make sense for it to also adjust the offset instead of crashing, IMO.
> [Python] slicing logic defective
> --------------------------------
>
> Key: ARROW-2288
> URL: https://issues.apache.org/jira/browse/ARROW-2288
> Project: Apache Arrow
> Issue Type: Bug
> Components: Python
> Affects Versions: 0.8.0
> Reporter: Antoine Pitrou
> Assignee: Antoine Pitrou
> Priority: Major
>
> The slicing logic tends to go too far when normalizing large negative bounds, which leads to results not in line with Python's slicing semantics:
> {code}
> >>> arr = pa.array([1,2,3,4])
> >>> arr[-99:100]
> <pyarrow.lib.Int64Array object at 0x7f550813a318>
> [
> 2,
> 3,
> 4
> ]
> >>> arr.to_pylist()[-99:100]
> [1, 2, 3, 4]
> >>>
> >>>
> >>> arr[-6:-5]
> <pyarrow.lib.Int64Array object at 0x7f54cd76a908>
> [
> 3
> ]
> >>> arr.to_pylist()[-6:-5]
> []
> {code}
> Also note this crash:
> {code}
> >>> arr[10:13]
> /home/antoine/arrow/cpp/src/arrow/array.cc:105 Check failed: (offset) <= (data.length)
> Abandon (core dumped)
> {code}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)