Discuss partitioned execution for ASOF joins

Aperta
#26,901 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
25/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
rust

Direzione di ricerca

Read the discussion and linked context in #26592, especially the feedback on the earlier pull request. The proposal concerns AsOfJoinExec, InputCursor, and hash-partitioned execution; compare its memory benefits with the reported slowdown for skewed keys. Done means reaching agreement on an execution design and a clear approach for a follow-up implementation.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Following #26592, I'd like to discuss the design before attempting another implementation.

I should have discussed the approach before opening the PR. Sorry about that.

Proposed approach

The main issue I'm trying to address is that AsOfJoinExec currently collects the entire right input into memory. This means ASOF joins can run out of memory on large right inputs, even when the upstream sorts can spill.

My idea was to use hash-partitioned execution when equality keys are present. Then i could just sort each partition according to the ordering required by the join and have each left partition stream its corresponding right partition instead of collecting and broadcasting the complete right input. Since InputCursor already advances through the right input, I thought this could reuse much of the existing join logic while removing the need to materialize the complete right side. The join would still need memory for its active batches, candidate matches, and pending output rows, but it would no longer need to collect the entire right input.

Tradeoffs

Hash-partitioning both inputs adds work compared to the existing broadcast approach. If most rows share the same equality key, one partition can end up doing most of the work. In my benchmarks, partitioned execution was nearly twice as slow for skewed keys.

Alternatives

Another possibility would be to make the existing right-input collection spillable. However, this would still require merging the right input into a single stream, and each left partition could end up rereading the spilled data.

I think supporting both broadcast and partitioned execution could make sense, depending on input size and key distribution

Additional context

The comment about my PR mentions proto and config as changes i made, highlighting them as something bad. Are we not allowed to

@Xuanwo implemented the original ASOF joins, so i'd appreciate his perspective on this. I noticed he hasnt been active on DataFusion recently, so I'm not sure if he will see this.

@jayzhan211 @alamb I'd also appreciate your thoughts on the design and on how i should approach it.

One thing I was also wondering about is the mention of config and proto changes in the feedback on my PR. Are these generally changes I should avoid making, or was the concern more about how many parts of DataFusion the PR touched without discussing the design first?

Lingua principale
Rust
Stelle
9.6k
Fork
2.6k
Merge medio
3g 4h
PR unite (30g)
345

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di apache/datafusion

Tutte le issue di apache/datafusion

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.