ump45nose opened a new pull request, #55422:
URL: https://github.com/apache/arrow/pull/55422

   ### Rationale for this change
   
   Fixes #55418.
   
   `pa.record_batch()` accepts `list` or `tuple` of arrays, but 
`RecordBatch.from_arrays` was Cython-typed as `list arrays`, so a tuple raised 
`TypeError: Argument 'arrays' has incorrect type (expected list, got tuple)`. 
`Table.from_arrays` already accepts untyped sequences.
   
   ### What changes are included in this PR?
   
   - Drop the Cython `list` type annotation on `RecordBatch.from_arrays` so 
tuples (and other sequences) work, matching `Table.from_arrays`.
   - Document parameters as list or tuple; clarify the `record_batch()` 
TypeError message.
   - Add a unit test for `pa.record_batch((array,), names=...)`.
   
   ### Are these changes tested?
   
   - Added `test_record_batch_from_tuple_of_arrays` in 
`python/pyarrow/tests/test_table.py`.
   - Full pyarrow rebuild/tests were not run in this environment (Cython 
extension); CI should cover it.
   
   ### Are there any user-facing changes?
   
   Yes: `pa.record_batch(tuple_of_arrays, ...)` and 
`RecordBatch.from_arrays(tuple_of_arrays, ...)` now work instead of raising 
TypeError.
   
   ### AI assistance
   
   Assisted by an AI coding tool for locating the Cython `list` annotation and 
drafting this PR text. I reviewed the call path against `Table.from_arrays` and 
confirmed the failure mode matches issue #55418.
   
   * GitHub Issue: #55418


-- 
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