apache / apache/arrow

[C++] Unique of StringView array incorrect with nulls

Open
#39,635 0 comments 0 reactions 0 assignees View on GitHub
Component: C++ Type: bug
Dominant language
C++
Stars
17.1k
Forks
4.3k
Avg merge
3d 13h
Merged PRs (30d)
88

Description

### Describe the bug, including details regarding any error messages, version, and platform.

Not a C++ reproducer, but with very preliminary (non-merged) Python bindings to illustrate it:

```
builder = pa.lib.StringViewBuilder()
builder.append("test")
builder.append("very long string that is not inlined")
builder.append(None)
builder.append("test")

>>> arr = builder.finish()
>>> arr

[
"test",
"very long string that is not inlined",
null,
"test"
]
>>> arr.type
DataType(string_view)
```

Calculating the `unique` values of this array includes the missing value as an empty string:

```
>>> arr.unique()

[
"test",
"very long string that is not inlined",
""
]
```

I didn't check in the code, but I _assume_ that it's "just" missing the validity bitmap (the empty string being the value that would otherwise be masked).

### Component(s)

C++

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.