rluvaton commented on code in PR #17244: URL: https://github.com/apache/datafusion/pull/17244#discussion_r2288364929
########## 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: Why not, split can also happen before spill so it can be called more than one time -- 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