[Python] Schema Field introspection fails on ListType
- Dominant language
- C++
- Stars
- 17.1k
- Forks
- 4.3k
- Avg merge
- 3d 13h
- Merged PRs (30d)
- 88
Description
### 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:
```python
test_schema = pa.schema([
('f0', pa.string()),
('f1', pa.list_(pa.string())),
])
```
The string representation is:
```
print(test_schema)
f0: string
f1: list
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:
```python
print(test_schema.field(1).name)
print(test_schema.field(1).flatten())
print(test_schema.field(1).flatten()[0].flatten())
...
```
```
f1
[pyarrow.Field>]
[pyarrow.Field>]
...
```
I would expect the following result:
```
f1
[pyarrow.Field>]
[pyarrow.Field]
```
That would allow to iterate through the whole schema fields.
### Component(s)
Python
Contributor guide
Assessment
This issue has not been assessed yet.