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

   ## Which issue does this PR close?
   
   - Closes #25071
   
   ## Rationale for this change
   
   With `enable_unions_to_filter` enabled, `UNION DISTINCT` branches containing 
different computed projections below their filters can be incorrectly treated 
as equivalent. This produces wrong result values and row counts without an 
error.
   
   ## What changes are included in this PR?
   
   `unions_to_filter` now skips the rewrite when a projection appears below a 
branch filter. Alias nodes remain safe to strip. A regression test covers 
branches computing `a + 100` and `a + 200` below their filters.
   
   ## What is the testing strategy for this PR?
   
   - `cargo +1.97.0-x86_64-pc-windows-gnullvm test --locked -p 
datafusion-optimizer unions_to_filter --lib` (9 passed)
   - The standalone reproducer returns `[1100, 1200]` with the optimizer 
setting both disabled and enabled after the fix.
   - `git diff --check`
   
   ## Are there any user-facing changes?
   
   This prevents incorrect query results when the opt-in `unions_to_filter` 
optimizer rule is enabled.


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