You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@arrow.apache.org by "Antoine Pitrou (Jira)" <ji...@apache.org> on 2019/12/18 13:37:00 UTC

[jira] [Assigned] (ARROW-7266) [Python] dictionary_encode() of a slice gives wrong result

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

Antoine Pitrou reassigned ARROW-7266:
-------------------------------------

    Assignee: Antoine Pitrou

> [Python] dictionary_encode() of a slice gives wrong result
> ----------------------------------------------------------
>
>                 Key: ARROW-7266
>                 URL: https://issues.apache.org/jira/browse/ARROW-7266
>             Project: Apache Arrow
>          Issue Type: Bug
>          Components: C++, Python
>    Affects Versions: 0.15.1
>         Environment: Docker on Linux 5.2.18-200.fc30.x86_64; Python 3.7.4
>            Reporter: Adam Hooper
>            Assignee: Antoine Pitrou
>            Priority: Major
>             Fix For: 1.0.0
>
>
> Steps to reproduce:
> {code:python}
> import pyarrow as pa
> arr = pa.array(["a", "b", "b", "b"])[1:]
> arr.dictionary_encode()
> {code}
> Expected results:
> {code}
> -- dictionary:
>   [
>     "b"
>   ]
> -- indices:
>   [
>     0,
>     0,
>     0
>   ]
> {code}
> Actual results:
> {code}
> -- dictionary:
>   [
>     "b",
>     ""
>   ]
> -- indices:
>   [
>     0,
>     0,
>     1
>   ]
> {code}
> I don't know a workaround. Converting to pylist and back is too slow. Is there a way to copy the slice to a new offset-0 StringArray that I could then dictionary-encode? Otherwise, I'm considering building buffers by hand....



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