alamb opened a new issue, #10678: URL: https://github.com/apache/datafusion/issues/10678
### Is your feature request related to a problem or challenge? in https://github.com/apache/datafusion/pull/10543 @peter-toth allowed the `TreeNode::apply` and `TreeNode::visit` APIs to return references However `LogicalPlan::apply_with_subqueries()` and `LogicalPlan::visit_with_subqueries()`, that are similar to TreeNode's base APIs but provide subquery support, weren't changed as well stricter easily. This is because in LogicalPlan::apply_expressions() and LogicalPlan::apply_subqueries() we create temporary Expr::eq, Expr::Column and LogicalPlan::Subquery objects that are not compatible with the root treenode's lifetime. ### Describe the solution you'd like Change https://github.com/apache/datafusion/blob/c095fee4a1675f37385656c110ae7aa553fb1a55/datafusion/expr/src/logical_plan/tree_node.rs#L777-L780 to be ```rust fn apply_with_subqueries<'n, F: FnMut(&'n Self) -> Result<TreeNodeRecursion>>( &'n self, mut f: F, ) -> Result<TreeNodeRecursion> { ``` ### Describe alternatives you've considered @peter-toth says > If we wanted to make the LogicalPlan visitor APIs stricter we would need further changes in LogicalPlan::Join, LogicalPlan::Unnest, LogicalPlan::Extension, Expr::Exists, Expr::InSubquery, Expr::ScalarSubquery enums, but I don't think we need those stricter APIs currently... ### Additional context _No response_ -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For additional commands, e-mail: github-h...@datafusion.apache.org