jayzhan211 commented on code in PR #11371: URL: https://github.com/apache/datafusion/pull/11371#discussion_r1676040274
########## datafusion/sql/src/expr/function.rs: ########## @@ -349,13 +350,31 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> { .map(|e| self.sql_expr_to_logical_expr(*e, schema, planner_context)) .transpose()? .map(Box::new); - return Ok(Expr::AggregateFunction(expr::AggregateFunction::new_udf( - fm, + + let raw_aggregate_function = RawAggregateUDF { + udf, args, distinct, filter, order_by, null_treatment, + }; + + for planner in self.planners.iter() { Review Comment: We can avoid clone like this ```rust for planner in self.planners.iter() { match planner.plan_aggregate_udf(raw_aggregate_function)? { PlannerResult::Planned(e) => return Ok(e), PlannerResult::Original(e) => { raw_aggregate_function = e; } } } return Ok(Expr::AggregateFunction(expr::AggregateFunction::new_udf( raw_aggregate_function.udf, raw_aggregate_function.args, raw_aggregate_function.distinct, raw_aggregate_function.filter, raw_aggregate_function.order_by, raw_aggregate_function.null_treatment, ))); ``` -- 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