apache / apache/datafusion

Add physical plan optimization to decide dictionary encoding

Open
#24,117 4 comments 1 reaction 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?

Even with good stats available, there's no optimizer rule that uses them to decide whether a string column should be dictionary-encoded.

### Describe the solution you'd like

Add a physical plan optimization pass that looks at column statistics (NDV, aggregation heaviness) as well as user-defined flags/thresholds, and decides whether to encode a given string column as a dictionary array.

Will need extensive testing and benchmarking to decide whether this should be enabled by default.

### Describe alternatives you've considered

Final piece of : #22891

part of epic : #24111

### Additional context

_No response_

Contributor guide

Open the contributing guide

Research direction

Start by reviewing issue #22891 and epic #24111 to understand the surrounding dictionary-encoding work. Then locate the physical-plan optimization and column-statistics entry points in DataFusion, and define tests and benchmarks covering NDV, aggregation heaviness, and user flags or thresholds. Done means the pass makes an encoding decision and provides evidence for whether it should be enabled by default.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
databases
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Needs clarification
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.