Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modify LogicalPlan::apply_with_subqueries() and LogicalPlan::visit_with_subqueries() to return subqueries #10678

Open
alamb opened this issue May 26, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@alamb
Copy link
Contributor

alamb commented May 26, 2024

Is your feature request related to a problem or challenge?

in #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

Make apply_with_subqueries, visit_with_subqueries, etc have the same lifetimes

Change

pub fn apply_with_subqueries<F: FnMut(&Self) -> Result<TreeNodeRecursion>>(
&self,
mut f: F,
) -> Result<TreeNodeRecursion> {

to be

    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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant