2010YOUY01 commented on code in PR #17244: URL: https://github.com/apache/datafusion/pull/17244#discussion_r2287954625
########## 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: Can we construct a dummy metric here? If we add it into operator's metrics set, it will display inside `EXPLAIN ANALYZE`, and I think this metric is not useful in `SortExec` ########## 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: Here caller is already accounting the memory, right? -- 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