Skip to content

Commit

Permalink
Add deprecated LogicalPlan::inspect_expressions
Browse files Browse the repository at this point in the history
  • Loading branch information
alamb committed Apr 7, 2024
1 parent 90e7941 commit 7c90e70
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions datafusion/expr/src/logical_plan/plan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,27 @@ impl LogicalPlan {
exprs
}

#[deprecated(since = "37.0.0", note = "Use `apply_expressions` instead")]
pub fn inspect_expressions<F, E>(self: &LogicalPlan, mut f: F) -> Result<(), E>
where
F: FnMut(&Expr) -> Result<(), E>,
{
let mut err = Ok(());
self.apply_expressions(|e| {
if let Err(e) = f(e) {
// save the error for later (it may not be a DataFusionError
err = Err(e);
Ok(TreeNodeRecursion::Stop)
} else {
Ok(TreeNodeRecursion::Continue)
}
})
// The closure always returns OK, so this will always too
.expect("no way to return error during recursion");

err
}

/// Calls `f` on all expressions (non-recursively) in the current
/// logical plan node. This does not include expressions in any
/// children.
Expand Down

0 comments on commit 7c90e70

Please sign in to comment.