#22298 added an optimization for LogicalPlan rewriting to avoid cloning the tree when not necessary via a new map_children_mut method.
We could probably add something similar to Expr. I'm less sure about Arc<dyn PhysicalExpr> and Arc<dyn ExecutionPlan> but we should generally explore our options for this method or other changes we might be able to make to the TreeNode API to make optimizer rules more efficient.
#22298 added an optimization for
LogicalPlanrewriting to avoid cloning the tree when not necessary via a newmap_children_mutmethod.We could probably add something similar to
Expr. I'm less sure aboutArc<dyn PhysicalExpr>andArc<dyn ExecutionPlan>but we should generally explore our options for this method or other changes we might be able to make to theTreeNodeAPI to make optimizer rules more efficient.