Apply an aggregate: grouping on the `group_expr` expressions and calculating `aggr_expr` aggregates for each distinct value of the `group_expr`;
(
self,
group_expr: impl IntoIterator<Item = impl Into<Expr>>,
aggr_expr: impl IntoIterator<Item = impl Into<Expr>>,
)
| 1284 | /// and calculating `aggr_expr` aggregates for each distinct |
| 1285 | /// value of the `group_expr`; |
| 1286 | pub fn aggregate( |
| 1287 | self, |
| 1288 | group_expr: impl IntoIterator<Item = impl Into<Expr>>, |
| 1289 | aggr_expr: impl IntoIterator<Item = impl Into<Expr>>, |
| 1290 | ) -> Result<Self> { |
| 1291 | let group_expr = normalize_cols(group_expr, &self.plan)?; |
| 1292 | let aggr_expr = normalize_cols(aggr_expr, &self.plan)?; |
| 1293 | |
| 1294 | let group_expr = if self.options.add_implicit_group_by_exprs { |
| 1295 | add_group_by_exprs_from_dependencies(group_expr, self.plan.schema())? |
| 1296 | } else { |
| 1297 | group_expr |
| 1298 | }; |
| 1299 | |
| 1300 | Aggregate::try_new(self.plan, group_expr, aggr_expr) |
| 1301 | .map(LogicalPlan::Aggregate) |
| 1302 | .map(Self::new) |
| 1303 | } |
| 1304 | |
| 1305 | /// Create an expression to represent the explanation of the plan |
| 1306 | /// |