fix: expand float fuzz coverage and correct discovered inconsistencies - #24433
Open
Theodus wants to merge 5 commits into
Open
fix: expand float fuzz coverage and correct discovered inconsistencies#24433Theodus wants to merge 5 commits into
Theodus wants to merge 5 commits into
Conversation
Contributor
|
cc @comphead since you worked on something similar before |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #24433 +/- ##
========================================
Coverage 81.23% 81.24%
========================================
Files 1112 1112
Lines 390635 390982 +347
Branches 390635 390982 +347
========================================
+ Hits 317350 317650 +300
- Misses 54650 54687 +37
- Partials 18635 18645 +10 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which issue does this PR close?
ScalarValue::eq_arrayis inconsistent withScalarValueequality for floating-point values #24431.MINandMAXreturn order-dependent results for NaNs and signed zeros #24432.Rationale for this change
Two floating-point edge cases produced inconsistent results:
ScalarValue::eq_arrayused IEEE equality for floats, whileScalarValueequality uses bit representations. An identical NaN therefore compared unequal, while+0.0and-0.0compared equal.MINandMAXused 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
ScalarValuearray conversions.What changes are included in this PR?
+0.0,-0.0, positive and negative infinities, and NaNs with varied signs and payloads in random Float32 and Float64 test data.ScalarValue::try_from_array,eq_array,to_array, anditer_to_arrayacross supported array types and sliced arrays.ScalarValue::eq_arraycomparisons use the same bitwise equality asScalarValue::PartialEq.MIN/MAXuse total ordering and total-order extrema as their initial accumulator values.Are these changes tested?
Yes. The existing
scalar_eq_arraytest 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_arraynow uses bitwise float equality, and grouped floating-pointMINandMAXnow return deterministic results consistent with DataFusion's existing total-order semantics. There are no API signature changes.