Repository navigation
Conversation
…value
Since ClickHouse #130054, DISTINCT (and UNION DISTINCT, which is a DISTINCT
over the union) treats -0. and 0. as one key and keeps the first row it sees,
so which of the two zeros a query prints depends on row order. TLPDistinct and
the UNION DISTINCT and INTERSECT checks of TLPSetOp compared the printed values
as strings, so the same set of values printed as {0} on one side and {-0} on
the other was reported as a mismatch.
Map -0 to 0 with ComparatorHelper.canonicalizeResultValue before these set
comparisons, as the DuckDB, Databend and Doris DISTINCT testers already do.
INTERSECT ALL and EXCEPT ALL still compare the zeros bitwise on master, so a
mismatch caused by that is still reported.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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 2026-11-28 master nightly (SQLancer (arm_asan_ubsan), SQLancer (arm_release)) reported 9
TLPDistinct/TLPSetOpfindings, all about-0vs0.Since ClickHouse/ClickHouse#130054,
DISTINCTtreats-0.and0.as one key and keeps the first row it sees, so which zero a query prints depends on row order.UNION DISTINCTis aDISTINCTover the union.TLPDistinctand theUNION_DISTINCTandINTERSECTchecks ofTLPSetOpcompared the printed values as strings, so{0}on one side and{-0}on the other became a finding. Indatabase4,SELECT DISTINCT ...printed0, 0and the partitioned query printed-0, 0for the same two rows.This maps
-0to0withComparatorHelper.canonicalizeResultValuebefore these comparisons, as the DuckDB, Databend and Doris DISTINCT testers already do.INTERSECT ALLandEXCEPT ALLstill compare the zeros bitwise on master (SELECT -0. INTERSECT ALL SELECT 0.is empty, whileINTERSECT DISTINCT, now a join, returns-0). The other 4 findings of that nightly (checkIntersectdropping the zero,checkExceptleaving-0) come from that server-side difference and are still reported.Checked against master 26.12.1.1 (debug build,
.claude/clickhouse-config/overrides):database4table replayed, the CI's twoTLPDistinctqueries, comparator call, 10 runsTLPDistinct,SetOpTLP, 10 threads, 10 minUNION_DISTINCT6,INTERSECT3), 14INTERSECT ALL/EXCEPT ALLINTERSECT ALL/EXCEPT ALLmvn verify -DskipTests=true -Djacoco.skip=truepasses with 0 Checkstyle violations.Related: ClickHouse/ClickHouse#128538
🤖 Generated with Claude Code