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

   ## Which issue does this PR address?
   
   Part of #24860. This is the logical schema propagation for CASE, 
complementary to #24865 (COALESCE/NVL/NVL2).
   
   ## What changes?
   
   - Preserve Arrow field metadata on CASE output only when all value-bearing 
branches agree on result type and metadata. Untyped NULL branches do not erase 
it; typed NULL branches carrying metadata remain eligible.
   - Preserve source metadata when the CASE coercion analyzer inserts 
compatible casts.
   - Walk nested CASE expressions iteratively to avoid recursive metadata 
inference and repeated subtree work. Ordinary non-CASE expression paths are 
unchanged.
   
   This does **not** fix metadata inside physical `CaseExpr` or constant-false 
CASE simplification. Those are separate follow-ups to #24860; this PR does not 
close that issue.
   
   ## Testing
   
   - `cargo test -p datafusion-expr -p datafusion-optimizer --lib`: 282 + 932 
passed.
   - `cargo fmt --all --check`: passed.
   - Focused Clippy passed with one existing, unrelated 
`clippy::from_iter_instead_of_collect` warning suppressed; unmodified upstream 
code triggers it.
   - Full extended workspace suite is running locally.
   - Independently reviewed for correctness, regressions, planning cost, API 
compatibility, and missing tests; approved for this logical-only scope.
   
   The tests cover matching/conflicting metadata, untyped and typed NULLs, 
coercion-inserted casts, and nested CASE.


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to