fix: use total_cmp for grouped float MIN/MAX accumulators (#24432) - #24435
Closed
waterWang wants to merge 1 commit into
Closed
fix: use total_cmp for grouped float MIN/MAX accumulators (#24432)#24435waterWang wants to merge 1 commit into
waterWang wants to merge 1 commit into
Conversation
Contributor
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?
Closes #24432.
What changes are included in this PR?
This PR fixes the grouped floating-point MIN and MAX accumulators to use
total_cmpinstead ofpartial_cmpfor Float16, Float32, and Float64.Problem:
partial_cmpreturnsNonefor NaN comparisons, causing thegrouped update closure to unconditionally overwrite the current value. This
makes results order-dependent:
MAX([NaN, 1.0])=1.0butMAX([1.0, NaN])=
NaN.Fix:
New
primitive_float_max_accumulatorandprimitive_float_min_accumulatormacros that use
total_cmp(IEEE 754 total ordering) instead ofpartial_cmp.Initial values changed from
$NATIVE::MIN/$NATIVE::MAX(finiteconstants) to
$NATIVE::NEG_INFINITY/$NATIVE::INFINITY(the trueextrema of the total ordering), so infinities and NaNs are handled correctly.
Are these changes tested?
Existing tests cover the non-grouped behavior. The grouped accumulators
now match the same total-ordering semantics.
Are there any user-facing changes?
Grouped
MIN/MAXon Float16, Float32, and Float64 columns will nowreturn deterministic results regardless of input order, batching, or
partitioning.
Before:
MAX([NaN, 1.0])=1.0(order-dependent)After:
MAX([NaN, 1.0])=NaN(deterministic)