inject_column_aliases_into_subquery

Function inject_column_aliases_into_subquery 

Source
pub(super) fn inject_column_aliases_into_subquery(
    plan: LogicalPlan,
    aliases: Vec<Ident>,
) -> Result<LogicalPlan>
Expand description

Injects column aliases into a subquery’s logical plan. The function searches for a Projection within the given plan, which may be wrapped by other operators (e.g., LIMIT, SORT). If the top-level plan is a Projection, it directly injects the column aliases. Otherwise, it iterates through the plan’s children to locate and transform the Projection.

Example:

  • SELECT col1, col2 FROM table LIMIT 10 plan with aliases ["alias_1", "some_alias_2"] will be transformed to
  • SELECT col1 AS alias_1, col2 AS some_alias_2 FROM table LIMIT 10