File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -490,18 +490,8 @@ fn map_children_mut<F: FnMut(&mut LogicalPlan) -> Result<bool>>(
490490/// # Error semantics
491491///
492492/// On `Err`, `*plan` is left in an **unspecified** state and must not be used.
493- /// Because `rule.rewrite()` consumes the plan by value, a failing rule drops
494- /// the node it was handed and the [`std::mem::take`] placeholder
495- /// (`LogicalPlan::default()`, an `EmptyRelation`) is left in its place — at the
496- /// root for a top-level failure, or somewhere in a subtree for a failure deeper
497- /// in the recursion. The pre-rule plan is **not** recoverable here: restoring it
498- /// would require cloning it before every rule invocation, which is exactly the
499- /// allocation this function exists to avoid.
500- ///
501- /// Callers must therefore discard `*plan` on `Err`, or restore it from a copy
502- /// saved beforehand. [`Optimizer::optimize`] does this: with `skip_failed_rules`
503- /// it restores `new_plan` from the `prev_plan` clone it already holds, and
504- /// without it the error aborts the pass and the plan is dropped unobserved.
493+ /// Note this is different than consuming APIs such as [`TreeNode::rewrite`]
494+ /// where the original plan is freed and no longer available on error
505495#[ cfg_attr( feature = "recursive_protection" , recursive:: recursive) ]
506496fn rewrite_plan_in_place (
507497 plan : & mut LogicalPlan ,
You can’t perform that action at this time.
0 commit comments