alamb commented on code in PR #15852: URL: https://github.com/apache/datafusion/pull/15852#discussion_r2065185660
########## datafusion/physical-plan/src/coalesce_batches.rs: ########## @@ -196,7 +196,14 @@ impl ExecutionPlan for CoalesceBatchesExec { } fn statistics(&self) -> Result<Statistics> { - Statistics::with_fetch(self.input.statistics()?, self.schema(), self.fetch, 0, 1) + self.partition_statistics(None) + } + + fn partition_statistics(&self, partition: Option<usize>) -> Result<Statistics> { + let input_stats = self.input.partition_statistics(partition)?; + let fetched_stat = + Statistics::with_fetch(input_stats.clone(), self.schema(), self.fetch, 0, 1)?; + Ok(fetched_stat) Review Comment: I think you can avoid a clone here. For example: ```suggestion self.input.partition_statistics(partition)?.with_fetch( self.schema(), self.fetch, 0, 1, ) ``` (This is the pattern you used elsewhere too like in CoalescePartitionsExec) -- 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