You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@arrow.apache.org by "Antoine Pitrou (Jira)" <ji...@apache.org> on 2020/10/07 15:58:00 UTC

[jira] [Resolved] (ARROW-10214) [Python] UnicodeDecodeError when printing schema with binary metadata

     [ https://issues.apache.org/jira/browse/ARROW-10214?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Antoine Pitrou resolved ARROW-10214.
------------------------------------
    Resolution: Fixed

Issue resolved by pull request 8379
[https://github.com/apache/arrow/pull/8379]

> [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: 0.17.0, 0.17.1, 1.0.0, 1.0.1
>         Environment: Python 3.6 - 3.8
>            Reporter: Paul Balanca
>            Assignee: Antoine Pitrou
>            Priority: Minor
>              Labels: pull-request-available
>             Fix For: 2.0.0
>
>          Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> 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)