Repository navigation
Fix flaky test 03366_bfloat16_sorting - #106684
Merged
alexey-milovidov merged 1 commit intoJun 7, 2026
Merged
alexey-milovidov merged 1 commit into
alexey-milovidov merged 1 commit into
Conversation
The test sorts a hand-built `BFloat16` array that contains five values which all round to the same `BFloat16` representation (`+0.0`, `+0.0`, `0.0`, `-0.0`, `0.0`). Equal sort keys have an implementation-defined relative order; under enough query-plan randomization the relative order of `-0` against the surrounding `0`s changes, and the result no longer matches the byte-exact `.reference` file. Pinning `max_threads = 1` makes the order produced by `MergeSortingTransform` deterministic and matches the committed reference. The test still exercises sorting of `BFloat16` values across the full input. Diagnosed by @alexey-milovidov on ClickHouse#93830 (comment) CI history: 4 hits across 4 unrelated PRs in 90 days (ClickHouse#93830, ClickHouse#100983, ClickHouse#100649, ClickHouse#96130), 0 master failures, 78957 OK runs / 1 FAIL in 30 days.
Collaborator
Author
Pre-PR validation gate
Session id: cron:clickhouse-ci-task-worker:20260607-161200 |
Collaborator
Author
|
cc @alexey-milovidov — could you review this? Pins |
1 task done
Contributor
|
Workflow [PR], commit [46f87d4] Summary: ✅ AI ReviewSummary
Final Verdict
|
Contributor
LLVM Coverage Report
Changed lines: No C/C++ source files changed — skipping uncovered code analysis. Newly covered by added/modified tests: 356 line(s), 20 function(s) across 133 file(s) · Details Top files
|
alexey-milovidov
approved these changes
Jun 7, 2026
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.
The test sorts a hand-built
BFloat16array that contains five values which all round to the sameBFloat16representation (+0.0,+0.0,0.0,-0.0,0.0). Equal sort keys have an implementation-defined relative order, and under the right combination of randomized query settings the relative order of-0against the surrounding0s changes, so the byte-exact.referenceno longer matches.Diagnosis is from @ alexey-milovidov on #93830 (comment): "
ORDER BY xoverBFloat16values where many distinct literals (including+0.0/-0.0/0.0) round to the same value; equal keys sort nondeterministically (the diff was exactly-0vs0reordering)."Pinning
max_threads = 1in the query'sSETTINGSclause makesMergeSortingTransformproduce a deterministic order and matches the committed reference. The test still exercises sorting ofBFloat16values across the full input.CI history: 4 hits across 4 unrelated PRs in 90 days (#93830, #100983, #100649, #96130), 0 master failures, 78,957 OK / 1 FAIL on the most recent 30 days.
CI report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=93830&sha=1ae1135cb1b82dd3952036c711434be2c391a12a&name_0=PR&name_1=Stateless%20tests%20%28amd_debug%2C%20parallel%29
Related: #93830
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
Version info
26.6.1.477