Repository navigation
Add test: ColumnDecimal::compareTrackAt res > 0 tracking branch untested in merge join - #105350
clickgapai wants to merge 3 commits into
Conversation
|
Pre-PR Validation Gate (per ClickGap pipeline): a) Deterministic repro? ✅ b) Root cause explained? ✅ c) Fix matches root cause? ✅ d) Test intent preserved? / New tests added? ✅ e) Both directions demonstrated? ✅ f) Fix is general, not a narrow patch? ✅ |
…erge join Imported from #105350 (commit 8d9dec1) to exercise the newly-covered-code analysis on a real tests-only change. The test covers the res > 0 branch of `ColumnDecimal::compareTrackAt`, which was not exercised by the existing merge-join decimal tests because their data always satisfied left <= right at comparison time. Co-Authored-By: ClickGap AI Bot <[email protected]> Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
On https://s3.amazonaws.com/clickhouse-test-reports/PRs/104714/738e5ba29bf22f2d5c23b2f4d296c98f56ecc9e8/llvm_coverage/newly_covered_code/newly_covered_code.log the report listed lots of `throw Exception(ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT, ...)` and `throw Exception(ErrorCodes::NUMBER_OF_ARGUMENTS_DOESNT_MATCH, ...)` lines in files entirely unrelated to the PR's change (`h3CellAreaM2.cpp`, `FunctionsExternalDictionaries.h`, ...). These are guard clauses that fuzzers and error-code coverage tests routinely hit; whether they appear in any given coverage run depends on which fuzz seeds executed, which is intrinsically non-deterministic across builds and was not filtered by the cross-validation against a second master baseline. Extend `_NOISE_PATTERNS` with `throw Exception(` and `ErrorCodes::`, and teach `_is_noise` to follow multi-line statements: walk back up to 8 lines past non-empty / non-terminator lines and check whether the enclosing statement is one of the noisy patterns. A line like arg->getName(), 1, getName()); at the tail of a multi-line `throw Exception(...)` no longer leaks through — the backward walk lands on the `throw Exception(` opening and classifies the whole statement as noise. Effect on the linked report: 392 -> 247 lines, 121 -> 69 files. The genuine `ColumnDecimal::compareTrackAt res>0` lines (96, 100-103) that PR #105350's test was designed to cover are correctly retained. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
|
Workflow [PR], commit [b91e8af] Summary: ❌
|
|
ClickGap AI Bot seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
| SELECT t1.id, t1.val, t2.id, t2.val FROM t1_dec_pm t1 INNER JOIN t2_dec_pm t2 ON t1.id = t2.id ORDER BY t1.id; | ||
| DROP TABLE IF EXISTS t3_dec_pm; | ||
| DROP TABLE IF EXISTS t4_dec_pm; | ||
| CREATE TABLE t3_dec_pm (id Decimal32(2), val Int32) ENGINE = MergeTree ORDER BY id; | ||
| CREATE TABLE t4_dec_pm (id Decimal32(2), val Int32) ENGINE = MergeTree ORDER BY id; | ||
| INSERT INTO t3_dec_pm VALUES (10.00, 100), (11.00, 110), (12.00, 120); | ||
| INSERT INTO t4_dec_pm VALUES (1.00, 1), (2.00, 2), (10.00, 10), (11.00, 11); | ||
| SELECT t3.id, t3.val, t4.id, t4.val FROM t3_dec_pm t3 INNER JOIN t4_dec_pm t4 ON t3.id = t4.id ORDER BY t3.id; |
There was a problem hiding this comment.
This query is still too weak to prove the compareTrackAt positive tracking path is working. In MergeJoinCursor::getNextEqualRangeImpl, a positive cmp only does rhs.nextN(cmp) (src/Interpreters/MergeJoin.cpp:396-399), so with a single join key the same final rows appear even if ColumnDecimal::compareTrackAt never returns a tracked skip and the engine just sees cmp == 1 three times in a row: 5 > 1, then 5 > 2, then 5 > 3, then 5 == 5.
That means both SELECTs here still pass if the res > 0 loop at src/Columns/ColumnDecimal.cpp:98-104 is bypassed or regresses to plain compareAt, so the claimed coverage gap stays open. Please make the first-key skip affect correctness, e.g. by using a second join key in the style of 04547_partial_merge_join_multikey_track.sql, where an incorrect cmp > 1 can miss or invent matches instead of silently producing the same result.
|
@clickgapai check the review comments and failing CI and make appropriate changes |
|
@groeneai can you take this up and open a new PR? |
|
Yes. Triaged as part of this batch of 20; the target code path still exists on master (2850e46) and the test passes there against its committed reference. I am re-filing the batch grouped by area rather than as 18 separate test PRs, to keep reviewer load down. Before filing, I mutation-test each oracle — in your previous batch two tests passed both with and without the defect, so I will not re-file one that does not actually redden. If this one turns out to be vacuous or already covered, I will post the reason here instead of a PR. Consolidated triage for the whole batch: #103950 (comment) |
|
Triage result: I am not re-filing this one, because I do not think the test would fail if the behaviour it targets regressed, and I did not have the budget to settle that by measurement.
I filed one PR from the batch of 18: #114234. Separately, the second query in this test may not be honouring |
Found via ClickGap automated review. Please close or comment if this is incorrect or needs adjustment.
This is a test-only PR — no source code changes. Please review: test quality, whether the claimed coverage gaps are real, and whether test output makes sense.
Adds test coverage for 1 untested code path(s), found during automated review of PR #105110.
That PR This PR adds
compareTrackAtmethod forColumnDecimalto optimize merge join performance. The method tracks how many consecutive rows can be skipped during merge join comparison. Two main branches: (1) same-scale path using direct comparison, (2) different-scale path usingdecimalLess. The PR's1.
ColumnDecimal::compareTrackAtres > 0 tracking branch untested in merge joinsrc/Columns/ColumnDecimal.cpp:100,src/Columns/ColumnDecimal.cpp:101Risk:
MergeJoin.cpp:168 callscompareTrackAt, which returns a positive value when left > right.MergeJoin.cpp:397-398 uses this value to skip right-side rows viarhs.nextN(cmp). If the tracking loop has bugs (e.g., wrong comparison condition), rows could be incorrectly skipped causing silent data loss in join results.What's unique vs PR tests: PR test 01881_join_on_conditions_merge_decimal.sql.j2 uses data where t1.id=[1,2,2,3], t2.id=[2,2,3,4] — always results in left <= right at comparison, never triggering res > 0 branch. My test uses t1.id=[5,6,7], t2.id=[1,2,3,5,6] which triggers res > 0 when t1[0]=5 > t2[0]=1.
Try it on ClickHouse Fiddle
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Not applicable — test-only change.
Documentation entry for user-facing changes