rewrite_recursive_unnest_bottom_up

Function rewrite_recursive_unnest_bottom_up 

Source
pub(crate) fn rewrite_recursive_unnest_bottom_up(
    input: &LogicalPlan,
    unnest_placeholder_columns: &mut IndexMap<Column, Option<Vec<ColumnUnnestList>>>,
    inner_projection_exprs: &mut Vec<Expr>,
    original_expr: &Expr,
) -> Result<Vec<Expr>>
Expand description

The context is we want to rewrite unnest() into InnerProjection->Unnest->OuterProjection Given an expression which contains unnest expr as one of its children, Try transform depends on unnest type

  • For list column: unnest(col) with type list -> unnest(col) with type list::item
  • For struct column: unnest(struct(field1, field2)) -> unnest(struct).field1, unnest(struct).field2

The transformed exprs will be used in the outer projection If along the path from root to bottom, there are multiple unnest expressions, the transformation is done only for the bottom expression