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

[jira] [Resolved] (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 ]

Kouhei Sutou resolved ARROW-7266.
---------------------------------
    Resolution: Fixed

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

> [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
>              Labels: pull-request-available
>             Fix For: 1.0.0
>
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> 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)