rkrishn7 commented on code in PR #14689:
URL: https://github.com/apache/datafusion/pull/14689#discussion_r1957547941


##########
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)`

Review Comment:
   Should we make the doc here more general to window functions?
   
   ```suggestion
       /// Plans window functions, such as `COUNT(<expr>)`
   ```



##########
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:
   FWIW, DuckDB formats `COUNT(*)` as `count_star` and preserves 
`COUNT(<expr>)` where `expr` isn't a wildcard.
   
   In this case, it looks like we don't preserve `COUNT(1)`.



##########
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)`

Review Comment:
   Same here regarding wording
   
   ```suggestion
       /// Plans aggregate functions, such as `COUNT(<expr>)`
   ```



-- 
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

Reply via email to