apache / apache/datafusion

Use pipeline aggregation when data is implicitly sorted by group-by keys

Offen
#19,655 2 Kommentare 0 Reaktionen 1 zugewiesene Person Beansprucht von @xavlee Auf GitHub ansehen
enhancement
Vorherrschende Sprache
Rust
Sterne
9.3k
Forks
2.4k
Ø Merge
3 T. 11 Std.
Gemergte PRs (30 T.)
362

Beschreibung

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

We have a use case where the query groups by columns that are implicitly sorted, and we would like DataFusion to recognize that ordering so it can apply pipeline aggregation.

Consider the following query:

```SQL
SELECT ...
FROM t
GROUP BY a, b;
```

In our data, the input is explicitly sorted only by `a`. However, `b` is always unique within each `(a, b)` pair, which means the data is implicitly sorted by `(a, b)` even though only `a` appears in the physical sort order.

If DataFusion could infer or be informed that the data is effectively sorted by (a, b), it would be able to use pipeline aggregation, resulting in better performance.

This is related to https://github.com/apache/datafusion/issues/16899

### Describe the solution you'd like

We need to define and propagate the uniqueness-based sort order.

### Describe alternatives you've considered

_No response_

### Additional context

_No response_

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.