alamb commented on code in PR #14689: URL: https://github.com/apache/datafusion/pull/14689#discussion_r1957332659
########## datafusion/expr/src/planner.rs: ########## @@ -211,6 +214,23 @@ pub trait ExprPlanner: Debug + Send + Sync { fn plan_any(&self, expr: RawBinaryExpr) -> Result<PlannerResult<RawBinaryExpr>> { Ok(PlannerResult::Original(expr)) } + + /// Plans Count(exprs), e.g., `COUNT(*) to Count(1)` + /// + /// Returns origin expression arguments if not possible Review Comment: ```suggestion /// Returns original expression arguments if not possible ``` ########## datafusion/expr/src/planner.rs: ########## @@ -211,6 +214,23 @@ pub trait ExprPlanner: Debug + Send + Sync { fn plan_any(&self, expr: RawBinaryExpr) -> Result<PlannerResult<RawBinaryExpr>> { Ok(PlannerResult::Original(expr)) } + + /// Plans Count(exprs), e.g., `COUNT(*) to Count(1)` + /// + /// Returns origin expression arguments if not possible + fn plan_aggregate( + &self, + expr: RawAggregateExpr, + ) -> Result<PlannerResult<RawAggregateExpr>> { + Ok(PlannerResult::Original(expr)) + } + + /// Plans Count(exprs), e.g., `COUNT(*) to Count(1)` + /// + /// Returns origin expression arguments if not possible Review Comment: ```suggestion /// Returns original expression arguments if not possible ``` ########## datafusion/core/src/execution/context/csv.rs: ########## @@ -116,11 +116,11 @@ mod tests { assert_eq!(results.len(), 1); let expected = [ - "+--------------+--------------+----------+", - "| sum(test.c1) | sum(test.c2) | count(*) |", - "+--------------+--------------+----------+", - "| 10 | 110 | 20 |", - "+--------------+--------------+----------+", + "+--------------+--------------+--------------+", + "| sum(test.c1) | sum(test.c2) | count_star() |", Review Comment: It would be great if this could stay `count(*)` Perhaps that is why you implemented `AggregateUDFImpl::display_name` 🤔 - https://github.com/apache/datafusion/pull/14695 ########## datafusion/core/tests/dataframe/mod.rs: ########## @@ -2447,8 +2448,8 @@ async fn test_count_wildcard_on_sort() -> Result<()> { let df_results = ctx .table("t1") .await? - .aggregate(vec![col("b")], vec![count(wildcard())])? Review Comment: Should we also deprecate `wildcard()` and Expr::Wildcard (in a follow on PR?) https://docs.rs/datafusion/latest/datafusion/logical_expr/fn.wildcard.html https://docs.rs/datafusion/latest/datafusion/prelude/enum.Expr.html#variant.Wildcard 🤔 -- 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