pub fn update_expr(
expr: &Arc<dyn PhysicalExpr>,
projected_exprs: &[ProjectionExpr],
sync_with_child: bool,
) -> Result<Option<Arc<dyn PhysicalExpr>>>Expand description
The function operates in two modes:
-
When
sync_with_childistrue:The function updates the indices of
exprif the expression resides in the input plan. For instance, given the expressionsa@1 + b@2andc@0with the input schemac@2, a@0, b@1, the expressions are updated toa@0 + b@1andc@2. -
When
sync_with_childisfalse: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 expressionsc@0,a@1andb@2, and the projection with an output schema ofa, c_new, thenc@0becomesc_new@1,a@1becomesa@0, butb@2results inNonesince the projection does not includeb.
ยงErrors
This function returns an error if sync_with_child is true and if any expression references
an index that is out of bounds for projected_exprs.
For example:
exprisa@3projected_exprsis [a@0,b@1]
In this case, a@3 references index 3, which is out of bounds for projected_exprs (which has length 2).