Repository navigation
Round Float64 results in test 02931_rewrite_sum_column_and_constant - #100410
Closed
alexey-milovidov wants to merge 4 commits into
Closed
alexey-milovidov wants to merge 4 commits into
alexey-milovidov wants to merge 4 commits into
Conversation
The test fails with TSan due to floating-point precision differences when random settings change the evaluation order of sum(constant - column). Wrap Float64 arithmetic queries with `round(..., 2)` to avoid flaky results. https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=98677&sha=c1d06924bbc951a62ad4a320efdcb22722d72d4b&name_0=PR&name_1=Stateless%20tests%20%28amd_tsan%2C%20parallel%2C%202%2F2%29 Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Contributor
Contributor
There was a problem hiding this comment.
Pull request overview
Adjusts a stateless regression test to be robust against benign Float64 rounding differences that appear under TSan + random settings when optimize_arithmetic_operations_in_aggregate_functions is toggled, preventing flaky expected output mismatches.
Changes:
- Wraps several
sum(... Float64 ...)result queries withround(..., 2)in02931_rewrite_sum_column_and_constant.sql. - Updates the corresponding
.referenceexpected outputs to match the rounded results.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| tests/queries/0_stateless/02931_rewrite_sum_column_and_constant.sql | Rounds Float64 aggregate results to avoid precision-dependent golden output. |
| tests/queries/0_stateless/02931_rewrite_sum_column_and_constant.reference | Updates expected output values to the rounded form. |
tiandiwonder
approved these changes
Mar 23, 2026
Master commit bee37fa already fixed the flaky test by changing the constant from `2.11` to `2.125`, which is exactly representable in binary floating-point. This makes the `round()` wrapping unnecessary. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
1 task
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.
Test
02931_rewrite_sum_column_and_constantfails under TSan with random settings due to floating-point precision differences. Whenoptimize_arithmetic_operations_in_aggregate_functionsis disabled,sum(2.11 - uint64)produces-4.45instead of-4.450000000000001. Both are valid results for the same mathematical value. Wrap Float64 arithmetic queries withround(..., 2)to avoid flaky results.https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=98677&sha=c1d06924bbc951a62ad4a320efdcb22722d72d4b&name_0=PR&name_1=Stateless%20tests%20%28amd_tsan%2C%20parallel%2C%202%2F2%29
#98677
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
...
Documentation entry for user-facing changes