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

Joris Van den Bossche updated ARROW-7266:
-----------------------------------------
    Fix Version/s: 1.0.0

> [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
>            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)

Reply via email to