fix: preserve cast target metadata - #24725
Conversation
|
Thank you for opening this pull request! Reviewer note: cargo-semver-checks reported the current version number is not SemVer-compatible with the changes in this pull request (compared against the base branch). Details |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #24725 +/- ##
==========================================
- Coverage 81.45% 81.43% -0.02%
==========================================
Files 1119 1120 +1
Lines 400411 401980 +1569
Branches 400411 401980 +1569
==========================================
+ Hits 326138 327368 +1230
- Misses 55198 55423 +225
- Partials 19075 19189 +114 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Is this the same / similar to ? |
yes it is the same. this popped up in my other PR and got too big for one PR. I am willing to review / discuss which approach is preferred. cc: @paleolimbot either way since this is blocking correctness I think should be in 55.1 release |
Which issue does this PR close?
Rationale for this change
A cast to a data type and a cast to an explicit Arrow field have different metadata semantics:
DataFusion currently stores both forms as a target
FieldRef. Once that field has empty metadata, planning cannot determine whether it was synthesized from aDataTypeor explicitly supplied. This can lose extension metadata, incorrectly retain metadata that should be cleared, or retain unnecessary same-type casts.What changes are included in this PR?
CastTarget::{DataType, Field}to represent cast intenttarget_fieldThis is the prerequisite fix for #24670
Are these changes tested?
Yes.
Are there any user-facing changes?
This changes the public
Cast::fieldandTryCast::fieldfields fromFieldReftoCastTargetso callers that use these structs must handle new enum.