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

   ## Which issue does this PR close?
   
   - Closes #27023.
   - Part of #14380. UNION inputs still need analyzer casts.
   
   ## Rationale for this change
   
   `DataFrame::schema()` previously reported the first UNION input's type while 
execution used the common type. UNION construction now infers the common output 
type.
   
   ## What changes are included in this PR?
   
   - Infer UNION and CASE result types before analysis, with cast insertion 
deferred to the analyzer.
   - Derive final UNION types from actual inputs with the shared 
`coerce_union_type` helper.
   - A branch-56 backport remains a maintainer decision because public 
inference behavior and one executed Arrow type change.
   
   Synthetic nested CASE planning (`ci-bench`, SQL through physical planning):
   
   | Depth | Main (µs) | Patch (µs) | Extra (µs) |
   | --- | --- | --- | --- |
   | 8 | 101.2 | 105.5 | +4.3 |
   | 32 | 270.1 | 317.6 | +47.5 |
   | 64 | 502.8 | 684.0 | +181.2 |
   
   These three points suggest roughly quadratic extra work. Extrapolating that 
trend to depth 1,000 gives about 45 ms of extra planning. The benchmark did not 
measure depth 1,000.
   
   ## What is the testing strategy for this PR?
   
   The extended suite (13,511 Rust tests), all 547 SLT files, full lint suite, 
all-features Clippy, and focused regressions pass.
   
   ## Are there any user-facing changes?
   
   The upgrade note in `docs/source/library-user-guide/upgrading/56.0.0.md` 
covers the change of `x` from `Dictionary(Int32, Utf8)` to `Utf8` in this query 
and the other inference changes.
   
   ```sql
   SELECT 1 AS y
   UNION ALL BY NAME
   SELECT arrow_cast('a', 'Dictionary(Int32, Utf8)') AS x;
   ```
   


-- 
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