jayzhan211 commented on issue #26705:
URL: https://github.com/apache/datafusion/issues/26705#issuecomment-7279386757

   @yashdotrv yes, that's the gap. One change to the plan: have 
`CoalescePartitionsExec` take its own reservation for the batches it queues, 
instead of carrying the partial aggregate's reservation along with the batch. 
The [memory pool 
contract](https://github.com/apache/datafusion/blob/b95ddfbbbd5857a980ff0cc7b0ef335d7dd1cdcb/datafusion/execution/src/memory_pool/mod.rs#L59-L62)
 says an operator doesn't reserve the batches it produces; the operator that 
holds them does.
   
   `RepartitionExec` already does this for its output channels, so I'd follow 
[`OutputChannel::send`](https://github.com/apache/datafusion/blob/b95ddfbbbd5857a980ff0cc7b0ef335d7dd1cdcb/datafusion/physical-plan/src/repartition/mod.rs#L214-L239):
 reserve each batch before it enters the channel, release it when the consumer 
reads it, and spill it to a `SpillPool` when the reservation is refused. Please 
keep that spill fallback rather than returning an error. 
`CoalescePartitionsExec` reserves nothing today, so an error on refusal would 
make queries that pass today fail there, not only `median` and `array_agg` ones.
   


-- 
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]

Reply via email to