[Python] Creating an array from a null list scalar fails
- 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.
Currently pyarrow fails to construct an array from a null list scalar:
```
>>> import pyarrow as pa
>>> pa.__version__
'15.0.0'
>>> pa.array([pa.scalar(None, pa.list_(pa.int64()))])
Traceback (most recent call last):
File "", line 1, in
File "pyarrow/array.pxi", line 344, in pyarrow.lib.array
File "pyarrow/array.pxi", line 42, in pyarrow.lib._sequence_to_array
File "pyarrow/error.pxi", line 154, in pyarrow.lib.pyarrow_internal_check_status
File "pyarrow/types.pxi", line 88, in pyarrow.lib._datatype_to_pep3118
File "pyarrow/scalar.pxi", line 685, in pyarrow.lib.ListScalar.__len__
TypeError: object of type 'NoneType' has no len()
```
This may be worked around by directly constructing the array and specifying the type when this case is detected:
```
>>> pa.array([None], type=pa.list_(pa.int64()))
[
null
]
```
### Component(s)
Python
Contributor guide
Assessment
This issue has not been assessed yet.