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

   ## Which issue does this PR close?
   
   - Closes #24431.
   - Closes #24432.
   
   ## Rationale for this change
   
   Two floating-point edge cases produced inconsistent results:
   
   - `ScalarValue::eq_array` used IEEE equality for floats, while `ScalarValue` 
equality uses bit representations. An identical NaN therefore compared unequal, 
while `+0.0` and `-0.0` compared equal.
   - Grouped floating-point `MIN` and `MAX` used partial ordering. With NaNs or 
signed zeros, results could depend on input order, batching, or partitioning 
and disagree with the non-grouped accumulators.
   
   Both issues were exposed by generating special floating-point values in fuzz 
data and adding fuzz coverage for `ScalarValue` array conversions.
   
   ## What changes are included in this PR?
   
   - Generate `+0.0`, `-0.0`, positive and negative infinities, and NaNs with 
varied signs and payloads in random Float32 and Float64 test data.
   - Add fuzz coverage checking consistency and round trips among 
`ScalarValue::try_from_array`, `eq_array`, `to_array`, and `iter_to_array` 
across supported array types and sliced arrays.
   - Make Float16, Float32, and Float64 `ScalarValue::eq_array` comparisons use 
the same bitwise equality as `ScalarValue::PartialEq`.
   - Make grouped Float16, Float32, and Float64 `MIN`/`MAX` use total ordering 
and total-order extrema as their initial accumulator values.
   
   ## Are these changes tested?
   
   Yes. The existing `scalar_eq_array` test now covers NaNs and signed zeros. 
New deterministic grouped-accumulator tests cover positive and negative NaNs, 
signed zeros, and the total-order sentinel values. The scalar conversion and 
aggregation fuzz tests cover the same paths across randomized arrays and 
execution configurations.
   
   ## Are there any user-facing changes?
   
   Yes. `ScalarValue::eq_array` now uses bitwise float equality, and grouped 
floating-point `MIN` and `MAX` now return deterministic results consistent with 
DataFusion's existing total-order semantics. There are no API signature changes.
   


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