Repository navigation
Add tests for compareTrackAt in partial_merge join - #110646
alexey-milovidov merged 4 commits into
Conversation
Covers compareTrackAt (devirtualized IColumn::compareAt for merge-sorted join, PR ClickHouse#99013) which the existing partial_merge tests do not exercise: - 04546: Float64/NaN/Inf keys (CompareHelper NaN handling, NaN=NaN match). NaN rows pinned last via isNaN() so ORDER BY is deterministic under randomized nan_direction_hint. - 04547: multi-key sort, first-key multi-row track skipping interacting with secondary-key matching. Co-Authored-By: Claude Opus 4.8 <[email protected]>
|
Workflow [PR], commit [0049e26] Summary: ✅ AI ReviewSummaryThis PR adds two stateless tests for Final Verdict✅ No new findings on the current patch. |
partial_merge currently matches NaN to NaN (bitwise compareAt returns 0), which diverges from equi-join semantics (NaN != NaN, as hash join follows). Freezing that into a regression test would block the correct semantic fix. Rework 04546 so the right table has no NaN key: the test still exercises Float compareTrackAt multi-row skipping and asserts +inf matches while NaN never matches, matching equi-join semantics. Co-Authored-By: Claude Opus 4.8 <[email protected]>
|
You are right: partial_merge currently matches NaN=NaN (bitwise `compareAt` returns 0), which diverges from equi-join semantics (hash join returns NaN != NaN). Freezing the NaN match would block the correct fix. Reworked so the right table has no NaN key: the test still exercises Float `compareTrackAt` multi-row skipping, asserts +inf matches, and asserts a NaN key never matches (equi-join semantics). Verified locally (5/5). |
But this PR attempts to fix this case #106540 |
…rge NaN semantics Make the NaN case composite (NaN first key on both sides, mismatching second key) so compareTrackAt actually compares NaN vs NaN, while the join still yields no NaN match. Correct the comment: partial_merge compares float keys bitwise, and PR ClickHouse#106540 leaves that unchanged, so the test is independent of the hash / full_sorting_merge NaN!=NaN equi-join fix. Co-Authored-By: Claude Opus 4.8 <[email protected]>
|
Good catch, and my earlier phrasing was misleading. On master today both hash and partial_merge match NaN=NaN bitwise; #106540 changes only hash / parallel_hash / grace_hash / full_sorting_merge / direct to NaN != NaN and its description explicitly leaves partial_merge comparing float keys bitwise. So partial_merge does NOT follow equi-join NaN semantics, and #106540 will not change that. I reworked 04546 accordingly (8f03785):
Net: 04546/04547 stay correct after #106540 lands, since neither depends on hash-side NaN semantics. |
Functional CI randomizes max_block_size. A small value splits the sorted left input into 1-2 row blocks, so MergeJoinCursor::compareTrackAt never returns |track| > 1 over the 7,8,9 < 10 run (04546) or the key1 runs (04547). The join result is unchanged, so the test still passes while silently losing the multi-row-skip coverage this PR adds. Pin max_block_size to keep the whole left input in one block. Co-Authored-By: Claude Opus 4.8 <[email protected]>
|
Pinned |
CI finish ledger — 0049e26CI fully finished (Finish Workflow + Mergeable Check + CH Inc sync all pass). No test failures on this head. Ready for review. Session id: cron:our-pr-ci-monitor:20260716-163000 |
…ial-merge-join-track Add tests for compareTrackAt in partial_merge join
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Description
Test-only. Adds
compareTrackAtcoverage for thepartial_mergejoin algorithm (the devirtualizedIColumn::compareAtused for merge-sorted joins, PR #99013). Reopens #99706, renumbered to 04546/04547.04546:Float64/+-Inf/NaNkeys. Exercises floatcompareTrackAtmulti-row skipping around+-inf. TheNaNcase is composite (NaNfirst key on both sides, mismatching second key) socompareTrackAtcomparesNaNvsNaNwhile the(k1, k2)join yields noNaNmatch.partial_mergecompares float keys bitwise; this is independent of the hash /full_sorting_merge/directNaN != NaNequi-join change in Treat float NaN keys as NULL on JOIN ON #106540, which explicitly leavespartial_mergeunchanged.04547: multi-key sort.compareTrackAtskips multiple rows on the first key, then falls back tocompareAtfor the secondary key on first-key ties.