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

   ## Which issue does this PR close?
   
   - Closes #27121.
   
   ## Rationale for this change
   
   Since #25187, short `Float32`/`Float64` literal IN lists are no longer 
rewritten into `=`/`<>` chains and stay as membership expressions. The 
membership filters compare floats by bit pattern, so `-0.0 IN (0.0, 5.0)` 
returns false even though `-0.0 = 0.0` is true. That's a behavior change from 
55.x.
   
   ## What changes are included in this PR?
   
   `ShortenInListSimplifier` still keeps short float lists as IN lists, except 
when one of the literals is `0.0` or `-0.0`. In that case it falls back to the 
comparison chain like before, so IN agrees with `=`. Lists without a zero keep 
the faster path.
   
   I went with the narrow fix rather than changing the filters to normalize 
zeros, since the bit-equality behavior there is covered by existing tests and 
also affects longer lists (the case mentioned at the end of the issue, which 
already behaves this way in 55). Happy to look at that separately if you'd 
prefer it handled in the filters.
   
   ## Are these changes tested?
   
   Yes:
   - New sqllogictest in `in_list.slt` covering `IN` / `NOT IN` with signed 
zero for DOUBLE and FLOAT columns. It fails on main and passes with this change.
   - Updated `simplify_inlist_signed_zero`: short float lists containing zero 
are now inlined, so the test evaluates them instead of expecting them unchanged.
   - `cargo test -p datafusion-optimizer` passes, clippy and fmt are clean.
   
   ## Are there any user-facing changes?
   
   No API changes. Short float IN lists containing zero now match `-0.0` and 
`0.0` the same way `=` does.
   


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