jayzhan211 commented on code in PR #10651: URL: https://github.com/apache/datafusion/pull/10651#discussion_r1623700021
########## datafusion/expr/src/expr_schema.rs: ########## @@ -158,7 +160,29 @@ impl ExprSchemable for Expr { .iter() .map(|e| e.get_type(schema)) .collect::<Result<Vec<_>>>()?; - fun.return_type(&data_types) + match fun { + WindowFunctionDefinition::AggregateUDF(udf) => { + let new_types = data_types_with_aggregate_udf(&data_types, udf).map_err(|err| { + plan_datafusion_err!( + "{} and {}", + err, + utils::generate_signature_error_msg( + fun.name(), + fun.signature().clone(), + &data_types + ) + ) + })?; + Ok(fun.return_type(&new_types)?) + } Review Comment: I prefer separate `coerce_types` and `return_types`. ########## datafusion/expr/src/expr_schema.rs: ########## @@ -158,7 +160,29 @@ impl ExprSchemable for Expr { .iter() .map(|e| e.get_type(schema)) .collect::<Result<Vec<_>>>()?; - fun.return_type(&data_types) + match fun { + WindowFunctionDefinition::AggregateUDF(udf) => { + let new_types = data_types_with_aggregate_udf(&data_types, udf).map_err(|err| { + plan_datafusion_err!( + "{} and {}", + err, + utils::generate_signature_error_msg( + fun.name(), + fun.signature().clone(), + &data_types + ) + ) + })?; + Ok(fun.return_type(&new_types)?) + } Review Comment: I prefer separate `coerce_types` and `return_types` given the difference between these two -- 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: github-unsubscr...@datafusion.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For additional commands, e-mail: github-h...@datafusion.apache.org