Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Python] Schema Field introspection fails on ListType #45527

Open
MainRo opened this issue Feb 13, 2025 · 1 comment
Open

[Python] Schema Field introspection fails on ListType #45527

MainRo opened this issue Feb 13, 2025 · 1 comment

Comments

@MainRo
Copy link

MainRo commented Feb 13, 2025

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

Doing introspection on a Schema object fails on ListType fields.
On this example schema:

test_schema = pa.schema([
    ('f0', pa.string()),
    ('f1', pa.list_(pa.string())),
])

The string representation is:

print(test_schema)
f0: string
f1: list<item: string>
  child 0, item: string

When doing introspection with the flatten method, it fails to go through the "item" layer of the list, and instead iterates infinitely on it:

print(test_schema.field(1).name)
print(test_schema.field(1).flatten())
print(test_schema.field(1).flatten()[0].flatten())
...
f1
[pyarrow.Field<f1: list<item: string>>]
[pyarrow.Field<f1: list<item: string>>]
...

I would expect the following result:

f1
[pyarrow.Field<f1: list<item: string>>]
[pyarrow.Field<f1.item: string>]

That would allow to iterate through the whole schema fields.

Component(s)

Python

@Agent-Hellboy
Copy link

Hi, can I take this up, it will help me explore the arrow codebase.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants