Applies a function `f` to each child expression of `self`. The function `f` determines whether to continue traversing the tree or to stop. This method collects all child expressions and applies `f` to each.
(
&'n self,
f: F,
)
| 44 | /// The function `f` determines whether to continue traversing the tree or to stop. |
| 45 | /// This method collects all child expressions and applies `f` to each. |
| 46 | fn apply_children<'n, F: FnMut(&'n Self) -> Result<TreeNodeRecursion>>( |
| 47 | &'n self, |
| 48 | f: F, |
| 49 | ) -> Result<TreeNodeRecursion> { |
| 50 | match self { |
| 51 | Expr::Alias(Alias { expr, .. }) |
| 52 | | Expr::Unnest(Unnest { expr }) |
| 53 | | Expr::Not(expr) |
| 54 | | Expr::IsNotNull(expr) |
| 55 | | Expr::IsTrue(expr) |
| 56 | | Expr::IsFalse(expr) |
| 57 | | Expr::IsUnknown(expr) |
| 58 | | Expr::IsNotTrue(expr) |
| 59 | | Expr::IsNotFalse(expr) |
| 60 | | Expr::IsNotUnknown(expr) |
| 61 | | Expr::IsNull(expr) |
| 62 | | Expr::Negative(expr) |
| 63 | | Expr::Cast(Cast { expr, .. }) |
| 64 | | Expr::TryCast(TryCast { expr, .. }) |
| 65 | | Expr::InSubquery(InSubquery { expr, .. }) |
| 66 | | Expr::SetComparison(SetComparison { expr, .. }) => expr.apply_elements(f), |
| 67 | Expr::GroupingSet(GroupingSet::Rollup(exprs)) |
| 68 | | Expr::GroupingSet(GroupingSet::Cube(exprs)) => exprs.apply_elements(f), |
| 69 | Expr::ScalarFunction(ScalarFunction { args, .. }) => { |
| 70 | args.apply_elements(f) |
| 71 | } |
| 72 | Expr::GroupingSet(GroupingSet::GroupingSets(lists_of_exprs)) => { |
| 73 | lists_of_exprs.apply_elements(f) |
| 74 | } |
| 75 | // TODO: remove the next line after `Expr::Wildcard` is removed |
| 76 | #[expect(deprecated)] |
| 77 | Expr::Column(_) |
| 78 | // Treat OuterReferenceColumn as a leaf expression |
| 79 | | Expr::OuterReferenceColumn(_, _) |
| 80 | | Expr::ScalarVariable(_, _) |
| 81 | | Expr::Literal(_, _) |
| 82 | | Expr::Exists { .. } |
| 83 | | Expr::ScalarSubquery(_) |
| 84 | | Expr::Wildcard { .. } |
| 85 | | Expr::Placeholder(_) |
| 86 | | Expr::LambdaVariable(_) => Ok(TreeNodeRecursion::Continue), |
| 87 | Expr::BinaryExpr(BinaryExpr { left, right, .. }) => { |
| 88 | (left, right).apply_ref_elements(f) |
| 89 | } |
| 90 | Expr::Like(Like { expr, pattern, .. }) |
| 91 | | Expr::SimilarTo(Like { expr, pattern, .. }) => { |
| 92 | (expr, pattern).apply_ref_elements(f) |
| 93 | } |
| 94 | Expr::Between(Between { |
| 95 | expr, low, high, .. |
| 96 | }) => (expr, low, high).apply_ref_elements(f), |
| 97 | Expr::Case(Case { expr, when_then_expr, else_expr }) => |
| 98 | (expr, when_then_expr, else_expr).apply_ref_elements(f), |
| 99 | Expr::AggregateFunction(AggregateFunction { params: AggregateFunctionParams { args, filter, order_by, ..}, .. }) => |
| 100 | (args, filter, order_by).apply_ref_elements(f), |
| 101 | Expr::WindowFunction(window_fun) => { |
| 102 | let WindowFunctionParams { |
| 103 | args, |
no test coverage detected