Add CastColumnExpr
support in projection mapping, equivalence properties, and interval utilities
#17881
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?
CastColumnExpr
#17761Rationale for this change
This PR extends DataFusion’s physical expression infrastructure to better handle column casts during projection equivalence, ordering propagation, and interval analysis.
Previously, only
Column
andCastExpr
were normalized or considered in equivalence groups. This caused mismatches when input fields and projection expressions diverged, especially in cases involvingCastColumnExpr
. By teaching the system to normalize and propagateCastColumnExpr
, we ensure:ProjectionMapping
CastColumnExpr
nodesThese changes improve correctness in downstream optimizations without altering external APIs.
What changes are included in this PR?
Projection Mapping (
projection.rs
)CastColumnExpr
input fields to align with theinput_schema
CastColumnExpr
with corrected onesEquivalence Properties (
properties/mod.rs
)CastColumnExpr
when widening casts preserve orderingIntervals Utilities (
intervals/utils.rs
)CastColumnExpr
incheck_support
Cast Column Expression Enhancements (
expressions/cast_column.rs
)cast_options
accessoris_widening_cast
helper to classify casts that preserve orderingTests
CastColumnExpr
input fieldsCastColumnExpr
CastColumnExpr
Are these changes tested?
✅ Yes.
projection_mapping_normalizes_cast_column_input_field
.supports_cast_column_expr
.Are there any user-facing changes?
CastColumnExpr
.