Repository navigation
GH-55575: [C++][Substrait] Fix inverted ddof for POPULATION/SAMPLE in DecodeBasicAggregate - #55582
Open
Mola-maker wants to merge 1 commit into
Open
Mola-maker wants to merge 1 commit into
Mola-maker wants to merge 1 commit into
Conversation
…PLE in DecodeBasicAggregate DecodeBasicAggregate mapped POPULATION to ddof=1 and SAMPLE to ddof=0, which is backwards: VarianceOptions uses N - ddof as the divisor, so population variance needs ddof=0 and sample variance needs ddof=1. The swap made a POPULATION request silently compute sample variance (and return NULL on a 1-row group), and vice versa. Fix the mapping and correct the AggregateRelOptions test, which encoded the buggy behavior, and add coverage for the SAMPLE distribution and for a single-row group (0.0 for POPULATION, NULL for SAMPLE). stddev shares this code path, so it is fixed by the same change.
|
|
Collaborator
|
@Mola-maker Pls use ARROW PR template. |
Author
|
ok,I'll rewrite the pr tomorrow.Thanks! |
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.
Fixes #55575.
DecodeBasicAggregatemapped Substrait'sdistributionoption backwards forvarianceandstd_dev:POPULATIONgotddof = 1andSAMPLEgotddof = 0.VarianceOptionsdivides byN - ddof, so population needsddof = 0and sample needsddof = 1. This swaps the two values;stddevshares the same code path.Tests: corrected
SubstraitRoundTrip.AggregateRelOptions(it encoded the buggy behavior) and addedAggregateRelOptionsSample,AggregateRelVarianceSingleRowGroup, andAggregateRelVarianceSingleRowGroupSample(single-row group:0.0forPOPULATION,NULLforSAMPLE).Verification (fork CI, run 43289990482):
arrow-substrait-substrait-testpassed in the ASAN UBSAN and ARM64 jobs (113/113 in the latter). The run's overall failure is two unrelated issues: the Conda AVX2 job fails to linkflight-grpc-example(mold: undefined symbolabsl::lts_20240722::Mutex::Dtor()), and the ASAN job's only failing test isarrow-azurefs-test(Azurite emulator failed to start, NodeERR_REQUIRE_ESM).