Skip to content

[Python][C++] Segfault when casting a sliced ListArray of int64 in v4.0.0 #28327

@asfimport

Description

@asfimport

Hi !

I just updated to pyarrow 4.0.0 and I noticed that a segfault happens when casting a sliced ListArray of int64. It crashes on both linux and windows. Here is a code to reproduce:

import pyarrow as pa

arr = pa.array([[i * 10] for i in range(4)])
print(type(arr))  # <class 'pyarrow.lib.ListArray'>
print(arr.type)  # list<item: int64>
arr.cast(pa.list_(pa.int32()))  # works
print(">>> Casting without slicing works")

arr = arr.slice(1)
print(type(arr))  # <class 'pyarrow.lib.ListArray'>
print(arr.type)  # list<item: int64>
arr.cast(pa.list_(pa.int32()))  # crashes !!
print(">>> This message isn't printed because casting with slicing causes a segfault")

On pyarrow 3.0.0 I used to get

ArrowNotImplementedError("Casting sliced lists (non-zero offset) not yet implemented")

instead of the segfault.

Thanks in advance for your help !

Reporter: quentin lhoest / @lhoestq

PRs and other links:

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions