DataFusion's Spillable Shuffle: Writing Batches to Disk Without Reordering Them
The shuffle spills selectively, not wholesale: one batch at a time, into a per-(input,output) FIFO pool, with a marker batch telling the reader to switch to disk.
The shuffle spills selectively, not wholesale: one batch at a time, into a per-(input,output) FIFO pool, with a marker batch telling the reader to switch to disk.
Spilling a GROUP BY means re-implementing its semantics on disk: sort the state runs, merge them with bounded memory, then replay through a clustered aggregate.
DataFusion’s PartialSortExec exploits an input that is already sorted by a prefix of the required ordering: it buffers one prefix group at a time, sorts just the suffix, and emits …
The repartition operator hashes each row once, concatenates per-partition row indices, performs exactly one take over the whole batch, and then slices the reordered result into …
When the input is already clustered by the grouping key, DataFusion detects it from the input’s ordering properties, tracks group completion with a tiny state machine, and interns …