UBarney commented on code in PR #15954:
URL: https://github.com/apache/datafusion/pull/15954#discussion_r2102533299
##########
datafusion/physical-plan/src/aggregates/mod.rs:
##########
@@ -751,28 +771,16 @@ impl AggregateExec {
})
}
_ => {
- // When the input row count is 0 or 1, we can adopt that
statistic keeping its reliability.
+ // When the input row count is 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()
- .partition_statistics(None)?
- .num_rows
- .get_value()
+ let num_rows = if let Some(value) =
child_statistics.num_rows.get_value()
{
- if *value > 1 {
- self.input()
- .partition_statistics(None)?
- .num_rows
- .to_inexact()
- } else if *value == 0 {
- // Aggregation on an empty table creates a null row.
Review Comment:
~~I think current unit test already covered it~~
~~+ [`group_by_expr.is_empty() and input_statistics.num_rows ==
0`](https://github.com/apache/datafusion/blob/0c7760aebd4e057196b363a173a9884bcdbb7236/datafusion/core/tests/physical_optimizer/partition_statistics.rs#L673-L708)~~
~~+ [`!group_by_expr.is_empty() and input_statistics.num_rows ==
0`](https://github.com/apache/datafusion/blob/0c7760aebd4e057196b363a173a9884bcdbb7236/datafusion/core/tests/physical_optimizer/partition_statistics.rs#L632-L663)~~~
--
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]