jorgecarleitao commented on issue #824: URL: https://github.com/apache/arrow-datafusion/issues/824#issuecomment-894746647
Thanks a lot for the context. I think this takes 2 components: * track memory * limit execution for when memory crosses threshold With respect to the first item, what about adding a new argument to `PhysicalPlan::execute` containing an execution state (which contains an `AtomicUsize` with current memory), and modify every implementation to update which memory was added and removed? This is passed by the execution context when the execution starts, and each node is responsible for passing to nodes that they themselves call. We can start by tracking memory of `RecordBatch`es, since they are the bulk of the memory. wrt to the second, since the execute is already `async`, we can block its execution at any point, e.g. `if memory > limit` return `Pending`. -- 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]
