Paul Balanca created ARROW-10214:
------------------------------------

             Summary: [Python] UnicodeDecodeError when printing schema with 
binary metadata
                 Key: ARROW-10214
                 URL: https://issues.apache.org/jira/browse/ARROW-10214
             Project: Apache Arrow
          Issue Type: Bug
          Components: Python
    Affects Versions: 1.0.1, 1.0.0, 0.17.1, 0.17.0
         Environment: Python 3.6 - 3.8
            Reporter: Paul Balanca


The following small example raises a `UnicodeDecodeError` error, since PyArrow 
version 0.17.0:
{code:java}
import pyarrow as pa

bdata = 
b"\xff\xff\xff\xff8\x02\x00\x00\x10\x00\x00\x00\x00\x00\n\x00\x0c\x00\x06\x00\x05\x00\x08\x00\n\x00\x00\x00\x00\x01\x04\x00\x0c\x00\x00\x00\x08\x00\x08\x00\x00\x00\x04\x00\x08\x00\x00\x00\x04\x00\x00\x00\x02\x00\x00\x00\x00\x01\x00\x00\x04\x00\x00\x00\x1a\xff\xff\xff\x00\x00\x00\x0c\xd0\x00\x00\x00\x9c\x00\x00\x00\x90\x00\x00\x00\x04\x00\x00\x00\x02\x00\x00\x00P\x00\x00\x00\x04\x00\x00\x00\xc0\xfe\xff\xff\x08\x00\x00\x00
 \x00\x00\x00\x14\x00\x00\x00ARROW:extension:name\x00\x00\x00\x00\x1b"

t = pa.table({"data": pa.array([1, 2])}, metadata={b"k": bdata})
print(t.schema){code}
In our case, the binary data is coming from the serialization of another 
PyArrow schema. But I guess the error can appear with any binary metadata in 
the schema.

The print used to work fine with PyArrow 0.16, getting this output:
{code:java}
data: int64
metadata
--------
OrderedDict([(b'k',
              b'\xff\xff\xff\xff8\x02\x00\x00\x10\x00\x00\x00\x00\x00\n\x00'
              b'\x0c\x00\x06\x00\x05\x00\x08\x00\n\x00\x00\x00\x00\x01\x04\x00'
              b'\x0c\x00\x00\x00\x08\x00\x08\x00\x00\x00\x04\x00'
              b'\x08\x00\x00\x00\x04\x00\x00\x00\x02\x00\x00\x00'
              b'\x00\x01\x00\x00\x04\x00\x00\x00\x1a\xff\xff\xff'
              b'\x00\x00\x00\x0c\xd0\x00\x00\x00\x9c\x00\x00\x00'
              b'\x90\x00\x00\x00\x04\x00\x00\x00\x02\x00\x00\x00P\x00\x00\x00'
              b'\x04\x00\x00\x00\xc0\xfe\xff\xff\x08\x00\x00\x00 \x00\x00\x00'
              b'\x14\x00\x00\x00ARROW:extension:name\x00\x00\x00\x00\x1b')])
{code}
I can work on a patch to reverse the behaviour back to PyArrow 0.16?



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to