Describe the bug, including details regarding any error messages, version, and platform.
Calling to_batches on a zero-row table returns an empty list, losing the schema information:
Python 3.13.5 (main, Jun 12 2025, 08:56:14) [GCC 13.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pyarrow as pa
>>> pa.__version__
'23.0.1'
>>> table = pa.table({"col": pa.array([], pa.int64())})
>>> table.to_batches()
[]
I would expect the result to be a single-element list, containing a RecordBatch with zero rows, and the same schema as the original table.
Component(s)
Python