Function update_expr

Source
pub fn update_expr(
    expr: &Arc<dyn PhysicalExpr>,
    projected_exprs: &[(Arc<dyn PhysicalExpr>, String)],
    sync_with_child: bool,
) -> Result<Option<Arc<dyn PhysicalExpr>>>
Expand description

The function operates in two modes:

  1. When sync_with_child is true:

    The function updates the indices of expr if the expression resides in the input plan. For instance, given the expressions a@1 + b@2 and c@0 with the input schema c@2, a@0, b@1, the expressions are updated to a@0 + b@1 and c@2.

  2. When sync_with_child is false:

    The function determines how the expression would be updated if a projection was placed before the plan associated with the expression. If the expression cannot be rewritten after the projection, it returns None. For example, given the expressions c@0, a@1 and b@2, and the ProjectionExec with an output schema of a, c_new, then c@0 becomes c_new@1, a@1 becomes a@0, but b@2 results in None since the projection does not include b.