apache / apache/datafusion

Materialize Dictionaries in Group Keys

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

Currently grouping on a dictionary column will return dictionary-encoded group keys. Given that group keys inherently have few repeated values, especially when grouping on a single column, the use of dictionary encoding is unlikely to be yielding significant returns. Additionally following https://github.com/apache/arrow-datafusion/pull/7587 computing the dictionary is a non-trivial operation that could be eliminated

### Describe the solution you'd like

When grouping on a dictionary column, e.g. `Dictionary(DataType::Int32, DataType::Utf8)`, the returned schema should be the underlying value type, i.e. `DataType::Utf8`.

### Describe alternatives you've considered

_No response_

### Additional context

_No response_

Contributor guide

Open the contributing guide

Research direction

Start by locating DataFusion's grouping implementation and tests for dictionary-encoded group keys; the issue does not name specific files or entry points. Confirm the current returned schema and identify the existing grouping behavior before changing it, then verify that grouping on Dictionary(Int32, Utf8) returns Utf8 keys without unnecessary dictionary materialization.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
data-engineering
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.