MCPcopy Create free account
hub / github.com/apache/datafusion / try_process_aggregate_unnest

Method try_process_aggregate_unnest

datafusion/sql/src/select.rs:567–595  ·  view source on GitHub ↗
(&self, input: LogicalPlan)

Source from the content-addressed store, hash-verified

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.

Callers 1

try_process_unnestMethod · 0.80

Calls 10

newFunction · 0.85
FilterClass · 0.50
anyMethod · 0.45
iterMethod · 0.45
cloneMethod · 0.45
buildMethod · 0.45
aggregateMethod · 0.45
with_optionsMethod · 0.45

Tested by

no test coverage detected