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

   ### Describe the bug, including details regarding any error messages, 
version, and platform.
   
   
   `pa.record_batch()` checks `isinstance(data, (list, tuple))` before passing 
`data` to `RecordBatch.from_arrays`
   
   
https://github.com/apache/arrow/blob/802102addbbbc386ef24e4c46d90644efe46a17d/python/pyarrow/table.pxi#L6046-L6048
   
   but a tuple of arrays raises a `TypeError` as `arrays` is typed as `list` in 
Cython:
   
   
https://github.com/apache/arrow/blob/802102addbbbc386ef24e4c46d90644efe46a17d/python/pyarrow/table.pxi#L3431
   
   Example:
   
   ```python
   >>> import pyarrow as pa
   >>> pa.record_batch((pa.array([1]),), names=["a"])
   Traceback (most recent call last):
     File "<python-input-2>", line 1, in <module>
       pa.record_batch((pa.array([1]),), names=["a"])
     File "pyarrow/table.pxi", line 6080, in pyarrow.lib.record_batch
       return RecordBatch.from_arrays(data, names=names, schema=schema,
   TypeError: Argument 'arrays' has incorrect type (expected list, got tuple)
   ```
   
   The same data passed as a list works.
   Note: `pa.table()` works correctly:
   
   ```python
   >>> pa.table(([1],), names=["a"])
   pyarrow.Table
   a: int64
   ----
   a: [[1]]
   ```
   
   I have found the issue when reviewing `__lib/table.pyi` in 
https://github.com/apache/arrow/pull/55264
   
   ### 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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to