Module optimize_projections

Module optimize_projections 

Source
Expand description

OptimizeProjections identifies and eliminates unused columns

Modulesยง

required_indices ๐Ÿ”’
RequiredIndices helper for OptimizeProjection

Structsยง

OptimizeProjections
Optimizer rule to prune unnecessary columns from intermediate schemas inside the LogicalPlan. This rule:

Functionsยง

add_projection_on_top_if_helpful ๐Ÿ”’
Adds a projection on top of a logical plan if doing so reduces the number of columns for the parent operator.
expr_contains_subquery ๐Ÿ”’
is_expr_trivial ๐Ÿ”’
is_projection_unnecessary
Projection is unnecessary, when
merge_consecutive_projections ๐Ÿ”’
Merges consecutive projections.
optimize_projections ๐Ÿ”’
Removes unnecessary columns (e.g. columns that do not appear in the output schema and/or are not used during any computation step such as expression evaluation) from the logical plan and its inputs.
outer_columns ๐Ÿ”’
Accumulates outer-referenced columns by the given expression, expr.
outer_columns_helper_multi ๐Ÿ”’
A recursive subroutine that accumulates outer-referenced columns by the given expressions (exprs).
plan_contains_other_subqueries ๐Ÿ”’
Returns true if the plan subtree contains any subqueries that are not the CTE reference itself. This treats any non-CTE LogicalPlan::SubqueryAlias node (including aliased relations) as a blocker, along with expression-level subqueries like scalar, EXISTS, or IN. These cases prevent projection pushdown for now because we cannot safely reason about their column usage.
rewrite_expr ๐Ÿ”’
Rewrites a projection expression using the projection before it (i.e. its input) This is a subroutine to the merge_consecutive_projections function.
rewrite_projection_given_requirements ๐Ÿ”’
Rewrite the given projection according to the fields required by its ancestors.
split_join_requirements ๐Ÿ”’
Splits requirement indices for a join into left and right children based on the join type.
subquery_alias_targets_recursive_cte ๐Ÿ”’