viirya commented on code in PR #8914:
URL: https://github.com/apache/arrow-datafusion/pull/8914#discussion_r1459754233
##########
datafusion/core/src/physical_optimizer/aggregate_statistics.rs:
##########
@@ -197,17 +197,28 @@ fn take_optimizable_min(
agg_expr: &dyn AggregateExpr,
stats: &Statistics,
) -> Option<(ScalarValue, String)> {
- let col_stats = &stats.column_statistics;
- if let Some(casted_expr) =
agg_expr.as_any().downcast_ref::<expressions::Min>() {
- if casted_expr.expressions().len() == 1 {
- // TODO optimize with exprs other than Column
- if let Some(col_expr) = casted_expr.expressions()[0]
- .as_any()
- .downcast_ref::<expressions::Column>()
+ if let Precision::Exact(num_rows) = &stats.num_rows {
+ if *num_rows > 0 {
Review Comment:
We could optimize MIN/MAX if the relation is empty. Since it is not the
issue, I will leave it as follow up.
--
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]