You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "waterWang (via GitHub)" <gi...@apache.org> on 2026/08/17 19:12:49 UTC

[PR] fix: use to_bits() comparison for float types in eq_array (#24431) [datafusion]

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

   ### Problem
   
   `ScalarValue::eq_array` is documented as an optimized equivalent of extracting an array element with `ScalarValue::try_from_array` and comparing the resulting scalars. However, for floating-point values `eq_array` uses IEEE equality (via the generic `eq_array_primitive!` macro) while `ScalarValue::PartialEq` compares bit representations, producing inconsistent results:
   
   - Identical NaN bit patterns compare equal as `ScalarValue`s but unequal through `eq_array`.
   - `+0.0` and `-0.0` compare unequal as `ScalarValue`s but equal through `eq_array`.
   
   ### Fix
   
   Replace the Float16, Float32, and Float64 branches of `eq_array` with custom `to_bits()` comparison, matching the semantics of `ScalarValue::PartialEq` for floats.
   
   Closes #24431


-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] fix: use to_bits() comparison for float types in eq_array (#24431) [datafusion]

Posted by "Jefffrey (via GitHub)" <gi...@apache.org>.
Jefffrey commented on PR #24436:
URL: https://github.com/apache/datafusion/pull/24436#issuecomment-5321971184

   - closing for reason here https://github.com/apache/datafusion/pull/24343#issuecomment-5290064956


-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] fix: use to_bits() comparison for float types in eq_array (#24431) [datafusion]

Posted by "Jefffrey (via GitHub)" <gi...@apache.org>.
Jefffrey closed pull request #24436: fix: use to_bits() comparison for float types in eq_array (#24431)
URL: https://github.com/apache/datafusion/pull/24436


-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org