Blizzara commented on code in PR #14553:
URL: https://github.com/apache/datafusion/pull/14553#discussion_r1954769286


##########
datafusion/expr/src/logical_plan/builder.rs:
##########
@@ -1090,11 +1090,31 @@ impl LogicalPlanBuilder {
         group_expr: impl IntoIterator<Item = impl Into<Expr>>,
         aggr_expr: impl IntoIterator<Item = impl Into<Expr>>,
     ) -> Result<Self> {
-        let group_expr = normalize_cols(group_expr, &self.plan)?;
+        self._aggregate(group_expr, aggr_expr, true)
+    }
+
+    pub fn aggregate_without_implicit_group_by_exprs(
+        self,
+        group_expr: impl IntoIterator<Item = impl Into<Expr>>,
+        aggr_expr: impl IntoIterator<Item = impl Into<Expr>>,
+    ) -> Result<Self> {
+        self._aggregate(group_expr, aggr_expr, false)
+    }
+
+    fn _aggregate(

Review Comment:
   Hm, the `plan` inside the LogicalPlanBuilder? You could just skip the 
builder completely:
   ```
           let input = consumer.consume_rel(input).await?;
           ...
           let group_exprs = normalize_cols(group_exprs, &input)?;
           let aggr_exprs = normalize_cols(aggr_exprs, &input)?;
           
           Ok(LogicalPlan::Aggregate(Aggregate::try_new(
               Arc::new(input),
               group_exprs,
               aggr_exprs,
           )?))
   ```
   
   But either is fine by me. @alamb do you have preferences, or thoughts on 
this overall (I feel it's weird the LogicalPlanBuilder::aggregate does this 
magic, but changing that is break, but also adding the 
`aggregate_without_implicit_group_by_exprs` feels a bit sad API... 



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