2010YOUY01 commented on code in PR #17029: URL: https://github.com/apache/datafusion/pull/17029#discussion_r2262568016
########## datafusion/physical-plan/src/spill/mod.rs: ########## @@ -54,8 +54,13 @@ use futures::{FutureExt as _, Stream}; struct SpillReaderStream { schema: SchemaRef, state: SpillReaderStreamState, + /// how much memory the largest memory batch is taking Review Comment: I recommend to also explain: this is used for validation, and link to the multi-level merge's doc for the background. ########## datafusion/physical-plan/src/spill/mod.rs: ########## @@ -125,6 +135,27 @@ impl SpillReaderStream { Ok((reader, batch)) => { match batch { Some(batch) => { + if let Some(max_record_batch_memory) = + self.max_record_batch_memory + { + let actual_size = + get_record_batch_memory_size(&batch); + if actual_size + > max_record_batch_memory + MEMORY_MARGIN + { + return Poll::Ready(Some(Err( + DataFusionError::ResourcesExhausted( Review Comment: We can use `resources_err!(...)` macro here -- 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: github-unsubscr...@datafusion.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For additional commands, e-mail: github-h...@datafusion.apache.org