xudong963 commented on code in PR #15852:
URL: https://github.com/apache/datafusion/pull/15852#discussion_r2065927159
##########
datafusion/physical-plan/src/aggregates/mod.rs:
##########
@@ -941,49 +994,15 @@ impl ExecutionPlan for AggregateExec {
}
fn statistics(&self) -> Result<Statistics> {
- // TODO stats: group expressions:
- // - once expressions will be able to compute their own stats, use it
here
- // - case where we group by on a column for which with have the
`distinct` stat
- // TODO stats: aggr expression:
- // - aggregations sometimes also preserve invariants such as min,
max...
- let column_statistics = Statistics::unknown_column(&self.schema());
- match self.mode {
- AggregateMode::Final | AggregateMode::FinalPartitioned
- if self.group_by.expr.is_empty() =>
- {
- Ok(Statistics {
- num_rows: Precision::Exact(1),
- column_statistics,
- total_byte_size: Precision::Absent,
- })
- }
- _ => {
- // When the input row count is 0 or 1, we can adopt that
statistic keeping its reliability.
- // When it is larger than 1, we degrade the precision since it
may decrease after aggregation.
- let num_rows = if let Some(value) =
- self.input().statistics()?.num_rows.get_value()
- {
- if *value > 1 {
- self.input().statistics()?.num_rows.to_inexact()
- } else if *value == 0 {
- // Aggregation on an empty table creates a null row.
- self.input()
- .statistics()?
- .num_rows
- .add(&Precision::Exact(1))
- } else {
- // num_rows = 1 case
- self.input().statistics()?.num_rows
- }
- } else {
- Precision::Absent
- };
- Ok(Statistics {
- num_rows,
- column_statistics,
- total_byte_size: Precision::Absent,
- })
- }
+ self.statistics()
Review Comment:
I changed to `statistics_inner`, it's good to avoid confusion, thanks!
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]