NoahKusaba opened a new issue, #2517: URL: https://github.com/apache/datafusion-ballista/issues/2517
**Is your feature request related to a problem or challenge? Please describe what you are trying to do.** The passthrough shuffle writer (`ShuffleWriterExec`) writes every batch it receives from its child as its own Arrow IPC message, with its own compression frame (`utils::write_stream_to_disk`). Unlike `SortShuffleWriterExec`, which rebuilds batches at `batch_size` when it interleaves rows into buckets, the passthrough writer keeps whatever batch sizes the child produces. After a selective `FilterExec`, or a `RepartitionExec` that spreads rows across many outputs, those batches can be only a few hundred rows. That makes shuffle files bigger, adds a compression frame for every tiny batch, and gives downstream readers more batches to decode. **Describe the solution you'd like** Coalesce batches up to the session `batch_size` before writing them, using arrow's `BatchCoalescer`. Batches larger than `batch_size / 2` should be written as-is when nothing is buffered, so large batches aren't copied. DataFusion's `CoalesceBatchesExec` uses the same setting ([`LimitedBatchCoalescer::new`](https://github.com/apache/datafusion/blob/7d3835c71f30cbd3c3ae4041732267f1f453097a/datafusion/physical-plan/src/coalesce/mod.rs#L63-L64)). **Describe alternatives you've considered** Inserting a `CoalesceBatchesExec` under the writer at planning time. Coalescing inside the writer keeps the work on the writer's blocking thread and doesn't change the stage plan. **Additional context** `ShuffleReaderExec` already coalesces on the read side with the same `batch_size`. Doing it at write time also cuts the number of IPC messages and compression frames stored on disk and sent over the network. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
