You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "kosiew (via GitHub)" <gi...@apache.org> on 2025/10/02 10:09:08 UTC

[PR] Add `CastColumnExpr` support in projection mapping, equivalence properties, and interval utilities [datafusion]

kosiew opened a new pull request, #17881:
URL: https://github.com/apache/datafusion/pull/17881

   
   ## Which issue does this PR close?
   
   * Closes #17761
   
   ---
   
   ## Rationale 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` and `CastExpr` were normalized or considered in equivalence groups. This caused mismatches when input fields and projection expressions diverged, especially in cases involving `CastColumnExpr`. By teaching the system to normalize and propagate `CastColumnExpr`, we ensure:
   
   * Input field consistency in `ProjectionMapping`
   * Correct ordering equivalence detection when casts are widening
   * Interval utilities that properly recurse through `CastColumnExpr` nodes
   
   These changes improve correctness in downstream optimizations without altering external APIs.
   
   ---
   
   ## What changes are included in this PR?
   
   * **Projection Mapping (`projection.rs`)**
   
     * Normalize `CastColumnExpr` input fields to align with the `input_schema`
     * Transform and replace mismatched `CastColumnExpr` with corrected ones
   
   * **Equivalence Properties (`properties/mod.rs`)**
   
     * Extend sort equivalence rules to include `CastColumnExpr` when widening casts preserve ordering
   
   * **Intervals Utilities (`intervals/utils.rs`)**
   
     * Add recursive support for `CastColumnExpr` in `check_support`
   
   * **Cast Column Expression Enhancements (`expressions/cast_column.rs`)**
   
     * Add `cast_options` accessor
     * Add `is_widening_cast` helper to classify casts that preserve ordering
   
   * **Tests**
   
     * New unit tests covering normalization of mismatched `CastColumnExpr` input fields
     * Extended ordering propagation test cases with `CastColumnExpr`
     * Interval utility tests confirming support for `CastColumnExpr`
   
   ---
   
   ## Are these changes tested?
   
   ✅ Yes.
   
   * Projection mapping normalization is verified by `projection_mapping_normalizes_cast_column_input_field`.
   * Ordering equivalence propagation is covered by new test cases (test case 6).
   * Interval utility recursion is tested with `supports_cast_column_expr`.
   
   ---
   
   ## Are there any user-facing changes?
   
   * No breaking API changes.
   * Internal improvements only; external behavior remains consistent.
   * Cast handling is now more robust and correct when projections involve `CastColumnExpr`.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] Add `CastColumnExpr` support in projection mapping, equivalence properties, and interval utilities [datafusion]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] closed pull request #17881: Add `CastColumnExpr` support in projection mapping, equivalence properties, and interval utilities
URL: https://github.com/apache/datafusion/pull/17881


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] Add `CastColumnExpr` support in projection mapping, equivalence properties, and interval utilities [datafusion]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #17881:
URL: https://github.com/apache/datafusion/pull/17881#issuecomment-3599858156

   Thank you for your contribution. Unfortunately, this pull request is stale because it has been open 60 days with no activity. Please remove the stale label or comment or this will be closed in 7 days.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org