(&self, input: LogicalPlan)
| 565 | } |
| 566 | |
| 567 | fn try_process_aggregate_unnest(&self, input: LogicalPlan) -> Result<LogicalPlan> { |
| 568 | match input { |
| 569 | // Fast path if there are no unnest in group by |
| 570 | LogicalPlan::Aggregate(ref agg) |
| 571 | if !&agg.group_expr.iter().any(has_unnest_expr_recursively) => |
| 572 | { |
| 573 | Ok(input) |
| 574 | } |
| 575 | LogicalPlan::Aggregate(agg) => { |
| 576 | let agg_expr = agg.aggr_expr.clone(); |
| 577 | let (new_input, new_group_by_exprs) = |
| 578 | self.try_process_group_by_unnest(agg)?; |
| 579 | let options = LogicalPlanBuilderOptions::new() |
| 580 | .with_add_implicit_group_by_exprs(true); |
| 581 | LogicalPlanBuilder::from(new_input) |
| 582 | .with_options(options) |
| 583 | .aggregate(new_group_by_exprs, agg_expr)? |
| 584 | .build() |
| 585 | } |
| 586 | LogicalPlan::Filter(mut filter) => { |
| 587 | filter.input = |
| 588 | Arc::new(self.try_process_aggregate_unnest(Arc::unwrap_or_clone( |
| 589 | filter.input, |
| 590 | ))?); |
| 591 | Ok(LogicalPlan::Filter(filter)) |
| 592 | } |
| 593 | _ => Ok(input), |
| 594 | } |
| 595 | } |
| 596 | |
| 597 | /// Try converting Unnest(Expr) of group by to Unnest/Projection. |
| 598 | /// Return the new input and group_by_exprs of Aggregate. |
no test coverage detected