Skip to content

Implement ExecutionPlan::map_expressions #20899

@LiaCastaneda

Description

@LiaCastaneda

Is your feature request related to a problem or challenge?

ExecutionPlan::apply_expressions (#20337) added a read-only visitor API for physical expressions. To complete the API that mirrors LogicalPlan::map_expressions — we should also implement a write counterpart that allows transforming expressions and reconstructing the node.

Use cases:

Describe the solution you'd like

Proposed API:

fn map_expressions<F>(
    self: Arc<Self>,
    f: &mut F,
) -> Result<Transformed<Arc<dyn ExecutionPlan>>>
where
    F: FnMut(Arc<dyn PhysicalExpr>) -> Result<Transformed<Arc<dyn PhysicalExpr>>>;

Each ExecutionPlan implementor is responsible for transforming its expressions and reconstructing itself using direct struct construction, so that the PlanProperties (schema, ordering, partitioning) are reused without recomputation -- matching the behavior of LogicalPlan::map_expressions.

Describe alternatives you've considered

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions