Skip to content

Conversation

rkrishn7
Copy link
Contributor

Which issue does this PR close?

What changes are included in this PR?

  • Renames reassign_predicate_columns to reassign_expr_columns
  • Updates usage

Are these changes tested?

No, there should be no changes in functionality.

Are there any user-facing changes?

N/A

@github-actions github-actions bot added physical-expr Changes to the physical-expr crates datasource Changes to the datasource crate physical-plan Changes to the physical-plan crate labels Sep 22, 2025

/// Return the equals Column-Pairs and Non-equals Column-Pairs
pub fn collect_columns_from_predicate(
fn collect_columns_from_predicate(
Copy link
Contributor Author

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

Copy link
Contributor

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

@alamb alamb added the api change Changes the API exposed to users of the crate label Sep 22, 2025
Copy link
Contributor

@alamb alamb left a 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(
Copy link
Contributor

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()
Copy link
Contributor

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)

Comment on lines 256 to 259
let index = match schema.index_of(column.name()) {
Ok(idx) => idx,
Err(_) if ignore_not_found => usize::MAX,
Err(e) => return Err(e.into()),
};
Copy link
Contributor

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

Suggested change
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())?;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api change Changes the API exposed to users of the crate datasource Changes to the datasource crate physical-expr Changes to the physical-expr crates physical-plan Changes to the physical-plan crate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Refactor usage of reassign_predicate_columns
2 participants