-
Notifications
You must be signed in to change notification settings - Fork 1.7k
chore: refactor usage of reassign_predicate_columns
#17703
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
base: main
Are you sure you want to change the base?
chore: refactor usage of reassign_predicate_columns
#17703
Conversation
|
||
/// Return the equals Column-Pairs and Non-equals Column-Pairs | ||
pub fn collect_columns_from_predicate( | ||
fn collect_columns_from_predicate( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm just realizing this was pub
and not pub(crate)
so technically this is an API change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe you can leave a #deprecated
version of the old name (that just calles the new name) as described in https://datafusion.apache.org/contributor-guide/api-health.html#deprecation-guidelines
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like a nice cleanup to me. Thank you for the contribution @rkrishn7
|
||
/// Return the equals Column-Pairs and Non-equals Column-Pairs | ||
pub fn collect_columns_from_predicate( | ||
fn collect_columns_from_predicate( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe you can leave a #deprecated
version of the old name (that just calles the new name) as described in https://datafusion.apache.org/contributor-guide/api-health.html#deprecation-guidelines
// Ignore any binary expressions that reference non-existent columns in the current schema | ||
// (e.g. due to unnecessary projections being removed) | ||
reassign_expr_columns(Arc::clone(expr), schema) | ||
.ok() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this ok
actually required? Does anything fail if we remove it?
It seems suspicious to me (though I see it is how the old code works too)
let index = match schema.index_of(column.name()) { | ||
Ok(idx) => idx, | ||
Err(_) if ignore_not_found => usize::MAX, | ||
Err(e) => return Err(e.into()), | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could further simplify this to
let index = match schema.index_of(column.name()) { | |
Ok(idx) => idx, | |
Err(_) if ignore_not_found => usize::MAX, | |
Err(e) => return Err(e.into()), | |
}; | |
let index = match schema.index_of(column.name())?; |
Which issue does this PR close?
reassign_predicate_columns
#17581What changes are included in this PR?
reassign_predicate_columns
toreassign_expr_columns
Are these changes tested?
No, there should be no changes in functionality.
Are there any user-facing changes?
N/A