Repository navigation
fix: preserve field metadata for simple CASE branches - #26145
osipovartem wants to merge 24 commits into
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #26145 +/- ##
==========================================
- Coverage 82.77% 82.76% -0.02%
==========================================
Files 1148 1148
Lines 451075 451632 +557
Branches 451075 451632 +557
==========================================
+ Hits 373397 373810 +413
- Misses 54930 54976 +46
- Partials 22748 22846 +98 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
PTAL at #24865 I originally had this strict metadata policy like you do here but changed it to be much more permissive on the basis of @paleolimbot 's comments. |
|
Thanks for pointing me to #24865. I agree CASE should use the same policy: merge unrelated metadata keys permissively, keep extension name/parameters paired, and reject conflicting extension names. The current strict full-map equality in this PR is inconsistent with that direction. I will align it with the shared helper and add CASE-specific tests for missing/unrelated metadata and conflicting extension names before this is merged. |
…-metadata # Conflicts: # datafusion/expr/src/expr_schema.rs
|
While I don't necessarily mind the approach here, I think it needs some justification for why it's needed over the simpler fix. This is a good workaround for when you don't control the ScalarUDF source code, but the actual bug here is that I put a note on the other PR as well, but I recently discovered |
Which issue does this PR address?
Part of #24860. This covers logical CASE field metadata, complementary to #24865.
What changes?
ExprSchema::field_and_nullablemethod preserves custom nullability overrides;DFSchemaresolves both from one field lookup. Once a THEN may be nullable, defer subsequent nullability decisions to the existing reachability-aware logic.Validation
datafusion-common --libpasses 644/644 tests;datafusion-expr --libpasses 301/301;datafusion-optimizer --libpasses 954/954, including custom-nullability/error and short-circuit regression cases. All-targets Clippy for both packages, rustfmt, and staged diff check pass.ci-benchprofile and host; expression construction is outside the timed loop. In this single short run, 1,000 distinct plain columns took ~1.420 ms before this PR and ~1.466 ms now: an observed +3.2% (~46 us) for a synthetic wide-schema planning case. Smaller plain-column cases were mixed; 1,000 plain literals were ~72.5 vs ~72.8 us. This does not establish end-to-end query performance or a statistically robust regression. The late-marked case is not a like-for-like performance comparison: the old code incorrectly omitted its metadata.