Skip to content

Extension types not fully supported in list arrays #45262

@chelsea-lin

Description

@chelsea-lin

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

Description

I'm trying to create a list array where each element is an array of a custom extension type, but I'm getting an ArrowNotImplementedError: extension.

Reproduction steps

Taken RelationType created in the pyarrow office doc as example (link),

import pyarrow as pa

class RationalType(pa.ExtensionType):
    # ... (Your RationalType code) ...

rational_type = RationalType(pa.int32())
data1 = [{"numer": 1, "denom": 17}, {"numer": 2, "denom": 13}]
data2 = [{"numer": 3, "denom": 34}, {"numer": 4, "denom": 60}]

pa.array(data1, type=rational_type)  # Works fine
pa.array([data1, data2], type=pa.list_(rational_type))  # Raises ArrowNotImplementedError

Actual behavior:

The code raises the following error:

---------------------------------------------------------------------------
ArrowNotImplementedError                  Traceback (most recent call last)
Cell In[33], [line 1](vscode-notebook-cell:?execution_count=33&line=1)
----> [1](vscode-notebook-cell:?execution_count=33&line=1) pa.array([data1, data2], type=pa.list_(rational_type))

File ~/src/python-db-dtypes-pandas/venv/lib/python3.12/site-packages/pyarrow/array.pxi:370, in pyarrow.lib.array()

File ~/src/python-db-dtypes-pandas/venv/lib/python3.12/site-packages/pyarrow/array.pxi:42, in pyarrow.lib._sequence_to_array()

File ~/src/python-db-dtypes-pandas/venv/lib/python3.12/site-packages/pyarrow/error.pxi:155, in pyarrow.lib.pyarrow_internal_check_status()

File ~/src/python-db-dtypes-pandas/venv/lib/python3.12/site-packages/pyarrow/error.pxi:92, in pyarrow.lib.check_status()

ArrowNotImplementedError: extension

Environment

  • pyarrow version: 18.1.0
  • Python version: 3.12.7

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