Skip to content

[Python] pa.types.is_nested() returns False for run-end encoded types #50847

Description

@Nishuuzz

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

pyarrow.types.is_nested() reports that a run-end encoded type is not nested, but the C++ arrow::is_nested() says it is.

>>> import pyarrow as pa
>>> t = pa.run_end_encoded(pa.int32(), pa.string())
>>> t.num_fields
2
>>> pa.types.is_nested(t)
False

The predicate in Python is backed by a hardcoded _NESTED_TYPES set in python/pyarrow/types.py, and Type_RUN_END_ENCODED was never added to it. If you line that set up against is_nested() in cpp/src/arrow/type_traits.h, run-end encoded is the only type the two disagree about — everything else matches, including the list-view types.

It also disagrees with the type itself: run-end encoded has two children (run ends and values), and every other type in pyarrow with children answers True here.

The same thing happened with fixed-size list, reported in #40171 and fixed in #40172, and the list-view types were added later. This looks like the last one that got missed when run-end encoding was added.

Tested with pyarrow 25.0.0 on Windows, and the same _NESTED_TYPES set is still there on main.

Component(s)

Python

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions