Skip to content

Single chunk ChunkedArray doesn't correctly respect copy in __array__method #49384

@BenLewis-Seequent

Description

@BenLewis-Seequent

Describe the bug, including details regarding any error messages, version, and platform.

The expectation is that if copy=True is passed into the __array__ method, the returned numpy array should be writable. This is true if the chunked array contains more than one chunk, but if the array contains a single chunk the returned array is not writable.

The below code:

pyarrow.chunked_array([[2, 3]]).__array__(copy=True).flags

Returns:

C_CONTIGUOUS : True
F_CONTIGUOUS : True
OWNDATA : False
WRITEABLE : False
ALIGNED : True WRITEBACKIFCOPY : False

I originally discovered this when numpy.array(chunked_array) returned a read-only array.

Environment:
Python: 3.13.0
OS: Linux
PyArrow version: 23.0.1

Component(s)

Python

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions