0x26res opened a new issue, #36889:
URL: https://github.com/apache/arrow/issues/36889
### Describe the bug, including details regarding any error messages,
version, and platform.
`pyarrow.csv.write_csv` works as expected, but when the first record batch
in a table is empty, it writes two headers (on 2 different lines) instead of
one:
```python
import pyarrow.csv
import pyarrow as pa
import io
table = pa.table({"col1": ["a", "b", "c"]})
with io.BytesIO() as fp:
pyarrow.csv.write_csv(table, fp)
fp.seek(0)
assert fp.read() == b'"col1"\n"a"\n"b"\n"c"\n'
with io.BytesIO() as fp:
pyarrow.csv.write_csv(pa.concat_tables([table.schema.empty_table(),
table]), fp)
fp.seek(0)
# THIS IS WRONG:
assert fp.read() == b'"col1"\n"col1"\n"a"\n"b"\n"c"\n'
```
### 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]