You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@arrow.apache.org by "Adam Hooper (Jira)" <ji...@apache.org> on 2019/11/26 14:35:00 UTC

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

Adam Hooper created ARROW-7266:
----------------------------------

             Summary: 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


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)