You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@arrow.apache.org by "mattaubury (via GitHub)" <gi...@apache.org> on 2024/06/04 16:33:22 UTC
[I] write_csv tries to write binary columns as UTF-8 and fails if they're invalid [arrow]
mattaubury opened a new issue, #41962:
URL: https://github.com/apache/arrow/issues/41962
### Describe the bug, including details regarding any error messages, version, and platform.
Tested on pyarrow-16.1.0 but also confirmed on the C++ API.
Minimal reproducer:
```
>>> import pyarrow as pa
>>> import pyarrow.csv
>>> import sys
>>> pa.csv.write_csv(pa.Table.from_arrays([pa.array([b'\xa2'])], names=["data"]), sys.stdout.buffer)
ArrowInvalid: Invalid UTF8 payload
```
It should probably write out an escaped string instead.
### Component(s)
C++, 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] [C++] write_csv tries to write binary columns as UTF-8 and fails if they're invalid [arrow]
Posted by "pitrou (via GitHub)" <gi...@apache.org>.
pitrou commented on issue #41962:
URL: https://github.com/apache/arrow/issues/41962#issuecomment-2358504421
For example Pandas doesn't seem to decode such an escape:
```python
>>> s = b'''"data"\n"\\xa2"\n'''
>>> print(s.decode())
"data"
"\xa2"
>>> x = pd.read_csv(io.BytesIO(s))['data'][0]
>>> x
'\\xa2'
```
cc @jorisvandenbossche for opinions
--
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
Re: [I] [C++] write_csv tries to write binary columns as UTF-8 and fails if they're invalid [arrow]
Posted by "pitrou (via GitHub)" <gi...@apache.org>.
pitrou commented on issue #41962:
URL: https://github.com/apache/arrow/issues/41962#issuecomment-2358497550
While it would be easy to write an escaped string, it's also not obvious it's what the user actually asked about. Do CSV readers typically unescape sequences such as `\xA2`?
--
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