jayzhan211 commented on code in PR #11371: URL: https://github.com/apache/datafusion/pull/11371#discussion_r1671416931
########## datafusion/expr/src/planner.rs: ########## @@ -161,6 +162,28 @@ pub trait ExprPlanner: Send + Sync { ) -> Result<PlannerResult<Vec<Expr>>> { Ok(PlannerResult::Original(args)) } + + /// Plans a `RawAggregateUDF` based on the given input expressions. + /// + /// Returns a `PlannerResult` containing either the planned aggregate function or the original + /// input expressions if planning is not possible. + fn plan_aggregate_udf( + &self, + aggregate_function: RawAggregateUDF, + ) -> Result<PlannerResult<RawAggregateUDF>> { + Ok(PlannerResult::Original(aggregate_function)) Review Comment: If we agree to convert `count()` to `count(1)` in planner. The conversion would be like ```rust fn plan_aggregate_udf( &self, aggregate_function: RawAggregateUDF, ) -> datafusion_common::Result<PlannerResult<RawAggregateUDF>> { let RawAggregateUDF { udf, args, distinct, filter, order_by, null_treatment } = aggregate_function; if udf.name() == "count" && args.is_empty() { let args = vec![lit(1)]; let expr = Expr::AggregateFunction(AggregateFunction {func_def: datafusion_expr::expr::AggregateFunctionDefinition::UDF(udf), args, distinct, filter, order_by, null_treatment}); return Ok(PlannerResult::Planned(expr)) } let aggregate_function = RawAggregateUDF { udf, args, distinct, filter, order_by, null_treatment }; Ok(PlannerResult::Original(aggregate_function)) } ``` -- 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