Slice an arrow array can lead to a negative length, when instead it should never be smaller than 0.
arr = pa.array(range(10))
assert len(arr[-9:-20]) == 0
Array.length() returns -1 which makes the previous snippet crash as Python never accepts length < 0
In particular if you have Python in debug mode it will explicitly fail the related assertion
Assertion failed: (len >= 0 || PyErr_Occurred()), function PyObject_Size, file Objects/abstract.c, line 61
Reporter: Alessandro Molina / @amol-
Assignee: Alessandro Molina / @amol-
Related issues:
Note: This issue was originally created as ARROW-12893. Please see the migration documentation for further details.
Slice an arrow array can lead to a negative length, when instead it should never be smaller than 0.
Array.length()returns-1which makes the previous snippet crash as Python never accepts length < 0In particular if you have Python in debug mode it will explicitly fail the related assertion
Assertion failed: (len >= 0 || PyErr_Occurred()), function PyObject_Size, file Objects/abstract.c, line 61Reporter: Alessandro Molina / @amol-
Assignee: Alessandro Molina / @amol-
Related issues:
Note: This issue was originally created as ARROW-12893. Please see the migration documentation for further details.