Dandandan opened a new pull request, #21326: URL: https://github.com/apache/datafusion/pull/21326
## Which issue does this PR close? N/A - performance improvement ## Rationale for this change `CoalescePartitionsExec::execute()` eagerly spawns tasks for all input partitions immediately, even before any batch is polled from the output stream. This wastes resources when streams are created but never consumed (e.g., query cancelled before first poll), and creates an unnecessary burst of concurrent tasks when many `CoalescePartitionsExec` nodes exist in a plan. ## What changes are included in this PR? Introduces a `CoalescePartitionsStream` that defers spawning input partition tasks until the first `poll_next()` call, rather than in `execute()`. The single-partition fast path is unchanged. ## How are these changes tested? All existing tests pass (8/8), covering: - Multi-partition merge - Single/multi partition with fetch limits - Drop cancellation - Panic propagation 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- 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]
