rluvaton commented on code in PR #17244: URL: https://github.com/apache/datafusion/pull/17244#discussion_r2286182169
########## datafusion/physical-plan/src/sorts/sort.rs: ########## @@ -720,7 +738,18 @@ impl ExternalSorter { Ok(sorted) }); - Ok(Box::pin(RecordBatchStreamAdapter::new(schema, stream))) + let mut output: SendableRecordBatchStream = + Box::pin(RecordBatchStreamAdapter::new(schema, stream)); + + if split { + output = Box::pin(BatchSplitStream::new( + output, + self.batch_size, + self.metrics.split_metrics.clone(), + )); Review Comment: The problem I have with `BatchSplitStream` is that it is not accounting for memory that it hold when it hold the batches -- 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