You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@arrow.apache.org by "vyasr (via GitHub)" <gi...@apache.org> on 2024/03/02 01:57:36 UTC

[I] Creating an array from a null list scalar fails [arrow]

vyasr opened a new issue, #40319:
URL: https://github.com/apache/arrow/issues/40319

   ### 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 "<stdin>", line 1, in <module>
     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()))
   <pyarrow.lib.ListArray object at 0x7f1d8e37f160>
   [
     null
   ]
   ```
   
   ### Component(s)
   
   Python


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@arrow.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Python] Creating an array from a null list scalar fails [arrow]

Posted by "AlenkaF (via GitHub)" <gi...@apache.org>.
AlenkaF commented on issue #40319:
URL: https://github.com/apache/arrow/issues/40319#issuecomment-1980857027

   Thanks for reporting @vyasr!
   
   I am actually getting a segfault when running the code locally. Unfortunately lldb is not giving me much extra information than this:
   
   ```python
   ```
   
   ```
   /Users/alenkafrim/repos/arrow/python/pyarrow/src/arrow/python/python_to_arrow.cc:532:  Check failed: (size) >= (offset) 
   ```
   
   https://github.com/apache/arrow/blob/ee1a8c39a55f3543a82fed900dadca791f6e9f88/python/pyarrow/src/arrow/python/python_to_arrow.cc#L532


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org