Migrate more code from Expr::to_columns to Expr::column_refs#11067
Merged
comphead merged 4 commits intoapache:mainfrom Jun 23, 2024
Merged
Migrate more code from Expr::to_columns to Expr::column_refs#11067comphead merged 4 commits intoapache:mainfrom
Expr::to_columns to Expr::column_refs#11067comphead merged 4 commits intoapache:mainfrom
Conversation
alamb
commented
Jun 22, 2024
| Some(expr) => { | ||
| // Extract columns from filter expression and saved in a HashSet | ||
| let cols = expr.to_columns()?; | ||
| let cols = expr.column_refs(); |
Contributor
Author
There was a problem hiding this comment.
this saves copying all the Columns (which have owned strings in them)
comphead
reviewed
Jun 22, 2024
datafusion/optimizer/src/utils.rs
Outdated
| /// Returns true if all columns in col_refs are in `schema_cols` | ||
| /// | ||
| /// Note: can't use `HashSet::intersect` here because they have different types. | ||
| pub(crate) fn has_all_refs( |
Contributor
There was a problem hiding this comment.
maybe we can rename it to better reflect if all columns in col_refs are in schema_cols` ?
comphead
approved these changes
Jun 22, 2024
findepi
pushed a commit
to findepi/datafusion
that referenced
this pull request
Jul 16, 2024
…che#11067) * Migrate code from `Expr::to_columns` to `Expr::column_refs`
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which issue does this PR close?
Part of #10505
Rationale for this change
We made an API to find column references without copying strings in #10948 and we should use it more.
What changes are included in this PR?
Expr::column_refsAPI introduced in Add Expr::column_refs to find column references without copying #10948 to avoid copyingAre these changes tested?
Covered by existing CI
Are there any user-facing changes?
No (though perhaps slightly faster planning)