Skip to content

[Python] Let array() return a ChunkedArray only when asked #55499

Open

Description

@tadeja

Describe the enhancement requested

pyarrow.array() returns Array except for two cases when it returns ChunkedArray:

array : pyarrow.Array or pyarrow.ChunkedArray
A ChunkedArray instead of an Array is returned if:
- the object data overflowed binary storage.
- the object's ``__arrow_array__`` protocol method returned a chunked
array.

Callers almost always expect an Array, so this is easy to miss. It also cannot be typed well in the stubs:

As suggested by @jorisvandenbossche in #55264 (comment) - long term this might be something we want to solve in the runtime, e.g. a keyword to indicate that a ChunkedArray return is allowed, but by default array() raising an error on it.

Component(s)

Python

Activity

  1. changed the title [-][Python] Return ChunkedArray only when asked for array()[/-] [+][Python] Let array() return a `ChunkedArray` only when asked[/+] on Nov 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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