apache / apache/datafusion

Support array sort for nested array

Open
#9,252 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Rust
Stars
9.3k
Forks
2.4k
Avg merge
3d 7h
Merged PRs (30d)
344

Description

### Is your feature request related to a problem or challenge?

Follow up on #8279
Benefit #9234

```
query error DataFusion error: Arrow error: Compute error: List\(Field \{ name: "item", data_type: Int64, nullable: true, dict_id: 0, dict_is_ordered: false, metadata: \{\} \}\) not supported in rank
select array_sort([[[1, 0, 2]], [[1, 2, 2]], [[1, 1, 2]]]);

query ?
select array_sort([[1, 0, 2], [1, 2, 2], [1, 1, 2]]);
----
[[1, 0, 2], [1, 1, 2], [1, 2, 2]]
```

We can handle 2D array but fails on the higher dimension.
The error `xxx not supported in rank` is due to `arrow-rs`, so this feature might need to fix the upstream first.

### Describe the solution you'd like

_No response_

### Describe alternatives you've considered

_No response_

### Additional context

File ticket upstream after the issue is clarified

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the failing nested-array query `select array_sort([[[1, 0, 2]], [[1, 2, 2]], [[1, 1, 2]]]);` and compare it with the working two-dimensional example. Investigate the reported Arrow error that `List` is not supported in rank, then clarify whether an upstream arrow-rs fix is required. Done means array_sort supports the higher-dimensional input and produces the expected sorted result.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
database
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.