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

Minor: Use ExprVisitor to find columns referenced by expr #2471

Merged
merged 1 commit into from
May 6, 2022

Conversation

alamb
Copy link
Contributor

@alamb alamb commented May 6, 2022

Which issue does this PR close?

re #2464

Rationale for this change

I noticed some code that duplicates Expr tree walking, and rewrote it to use ExprVisitor

What changes are included in this PR?

Rewrite find_columns_referenced_by_expr from #2464

Are there any user-facing changes?

no

@github-actions github-actions bot added the datafusion Changes in the datafusion crate label May 6, 2022
@@ -251,77 +251,6 @@ pub enum Expr {
QualifiedWildcard { qualifier: String },
}

/// Recursively find all columns referenced by an expression
pub fn find_columns_referenced_by_expr(e: &Expr) -> Vec<Column> {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is less code, but it also avoids potential issues in missing a sub expr

Copy link
Member

@andygrove andygrove left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @alamb that is much nicer.

@alamb alamb merged commit de7f15b into apache:master May 6, 2022
@alamb alamb deleted the alamb/use_expr_visitor branch August 8, 2023 20:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
datafusion Changes in the datafusion crate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants