Skip to main content

Module function_rename

Module function_rename 

Source
Expand description

Function-call name-substitution walker.

Used by the planner to apply ReplacementScanProvider-driven function rewrites (M5 follow-up #5) as an AST pass before logical planning. The walker descends into all expression-bearing positions and calls a caller-supplied closure for each Expr::FunctionCall name. If the closure returns Some(new_name), the call’s name is substituted in place; arguments are recursively walked either way. Errors short-circuit the entire traversal.

Mirrors the traversal shape of crate::rewrite::walker::ExpressionWalker — the two could eventually share a visitor trait, but for now the duplication is deliberate: this walker takes &mut FnMut (so it can capture the planner’s &self plus mutable state for hop-cap enforcement) and propagates Result (so a wrong-variant or already-rerouted error aborts cleanly), neither of which the rule-driven walker supports.

Functions§

rewrite_function_calls_in_query
Walk query, calling rename on every Expr::FunctionCall name (post-order: arguments are visited first). When rename returns Some(new_name), the call’s name is replaced. When it returns None, the original name is kept. Errors propagate.