apache / apache/arrow-rs

Implement `unique` function

Open
#4,698 3 comments 1 reaction 0 assignees View on GitHub
enhancement
Dominant language
Rust
Stars
3.6k
Forks
1.3k
Avg merge
2d 14h
Merged PRs (30d)
167

Description

**Is your feature request related to a problem or challenge? Please describe what you are trying to do.**
Part of https://github.com/apache/arrow-datafusion/issues/7289

**Describe the solution you'd like**
`unique` function removes duplicate values (include NULLs) from `Array`. Does preserve the original order.

Example (PyArrow):
```
>>> pc.unique(pa.array([1, 2, 1, 4, 5, 2, 4, 1]))

[
1,
2,
4,
5
]
```

with nulls:

```
>>> pc.unique(pa.array([1, 2, 1, 4, None, 5, 2, None, 4, 1]))

[
1,
2,
4,
null,
5
]
```

**Describe alternatives you've considered**

**Additional context**
Documentation: https://arrow.apache.org/docs/cpp/compute.html

Contributor guide

Open the contributing guide

Research direction

Start with the linked Arrow compute documentation and the examples in this issue, then locate the Rust array compute entry points for implementing functions. Done means a unique operation preserves first-seen order, removes duplicate values, and includes at most one NULL; no specific source file or test is named in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
data
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.