alamb commented on code in PR #18091:
URL: https://github.com/apache/datafusion/pull/18091#discussion_r2436954731
##########
datafusion/expr/src/test/function_stub.rs:
##########
@@ -488,8 +490,61 @@ impl AggregateUDFImpl for Avg {
&self.signature
}
+ fn coerce_types(&self, arg_types: &[DataType]) -> Result<Vec<DataType>> {
Review Comment:
I think the stubs are needed to avoid circular dependencies (functions
depend on datafusion-expr, but datafusion-expr doesn't depend on functions)
##########
datafusion/functions-aggregate/src/average.rs:
##########
@@ -125,8 +126,61 @@ impl AggregateUDFImpl for Avg {
&self.signature
}
+ fn coerce_types(&self, arg_types: &[DataType]) -> Result<Vec<DataType>> {
+ let [args] = take_function_args(self.name(), arg_types)?;
+
+ // Supported types smallint, int, bigint, real, double precision,
decimal, or interval
+ // Refer to
https://www.postgresql.org/docs/8.2/functions-aggregate.html doc
+ fn coerced_type(data_type: &DataType) -> Result<DataType> {
Review Comment:
should we perhaps inline the function too as you have done below?
##########
datafusion/expr-common/src/type_coercion/aggregates.rs:
##########
@@ -144,260 +106,3 @@ pub fn check_arg_count(
}
Ok(())
}
-
-/// Function return type of a sum
-pub fn sum_return_type(arg_type: &DataType) -> Result<DataType> {
Review Comment:
If users want them, they can copy them into their own code on upgrade
--
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]