apache / apache/datafusion

Investigate why Utf8View performs worse for sort with high cardinality cases and improve it.

Open
#15,402 2 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?

This is a follow-up for the comments:
https://github.com/apache/datafusion/pull/15348#issuecomment-2749309575

Original result:

## **High Cardinality Performance**
| Sorting Method | `utf8` Time (ms) | `utf8_view` Time (ms) | `utf8_view` Improvement |
|----------------------|-----------------|------------------|------------------|
| **merge sorted** | **4.6662** | 5.0999 | **-9.3% (slower)** |
| **sort merge** | **4.7102** | 5.7224 | **-21.5% (slower)** |
| **sort** | **7.0020** | 6.3274 | **9.6% faster** |
| **sort partitioned** | **242.99 µs** | 679.86 µs | **-180% (much slower)** |

### **Observations**
- `utf8_view` **performs worse** for high cardinality cases:
- **merge sorted is 9.3% slower**.
- **sort merge is 21.5% slower**.
- **sort partitioned is 180% slower**, a drastic drop.
- However, `utf8_view` **still improves** the `sort` method by **9.6%**, likely due to reduced string operations.

We need to investigate why Utf8View performs worse for high cardinality cases and improve it.

### Describe the solution you'd like

_No response_

### Describe alternatives you've considered

_No response_

### Additional context

_No response_

Contributor guide

Open the contributing guide

Research direction

No source file or test is named. Start by reviewing the linked pull request comment and reproducing the high-cardinality results for merge sorted, sort merge, sort, and sort partitioned with Utf8View and utf8. Done means identifying why Utf8View regresses and improving the affected sorting cases without losing its benefit for sort.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
databases, performance
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.