alamb commented on code in PR #13736:
URL: https://github.com/apache/datafusion/pull/13736#discussion_r1885708573
##########
datafusion/physical-expr-common/src/physical_expr.rs:
##########
@@ -149,6 +151,11 @@ pub trait PhysicalExpr: Send + Sync + Display + Debug +
DynEq + DynHash {
fn get_properties(&self, _children: &[ExprProperties]) ->
Result<ExprProperties> {
Ok(ExprProperties::new_unknown())
}
+
+ /// Return the column statistics of this expression given the statistics
of the input
Review Comment:
This API seems somewhat overlapping with
[`PhysicalExpr::evaluate_bounds`](https://docs.rs/datafusion/latest/datafusion/physical_expr/trait.PhysicalExpr.html#method.evaluate_bounds)
I wonder if there is any way to combine the ideas with the `Statistics`
changes @suremarc is looking into in
https://github.com/apache/datafusion/pull/13293#issuecomment-2540053084 🤔
##########
datafusion/functions-aggregate/src/average.rs:
##########
@@ -253,6 +254,34 @@ impl AggregateUDFImpl for Avg {
coerce_avg_type(self.name(), arg_types)
}
+ fn value_from_stats(&self, statistics_args: &StatisticsArgs) ->
Option<ScalarValue> {
+ if statistics_args.is_distinct {
+ return None;
+ }
+
+ if let Precision::Exact(num_rows) =
&statistics_args.statistics.num_rows {
Review Comment:
this is a very neat idea
--
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]