Repository navigation
Disable primary-key range sharding in 05629_explain_analyze_join_side_q_error - #132149
Conversation
…_q_error With `query_plan_join_shard_by_pk_ranges` (on by default) both tables are split into primary-key ranges, each joined with its own hash table, and `JoiningTransform` does not read the probe rows of a range whose hash table is empty (`HashJoin::alwaysReturnsEmptySet`). The side counters are exact, so the left side then reports fewer rows than the table holds and the test's `rows 1.00 thousand` assertions fail. Deterministic with `--max_threads 2` and `--index_granularity 998 --min_bytes_for_wide_part 0`: the last range is `k = 999`, which has no `d.v = 3` row, so 999 rows are read. Pin the setting off next to `enable_join_runtime_filters = 0`, which is there for the same reason. The sharded path is covered by 04891_explain_analyze_join_estimation, which forces it on. The `EXPLAIN ANALYZE` help text gets one sentence saying that a sharded hash join, like a runtime filter, lowers the actual rows of a side. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Internal second-model review: adjudication log (click to expand)Pre-publication review by an independent model (engine: codex; 1 finding; 2 full passes, the second on the corrected PR description: 0 findings).
Severity: ❌ blocker / Session id: cron:clickhouse-review-slot-8:20261116-213009 |
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-impl-slot-7:20261116-210700 |
|
Workflow [PR], commit [8bd5b08] Summary: ❌
AI ReviewSummaryThe PR disables Final VerdictStatus: ✅ Approve |
CI finish ledger - 8bd5b08Every failure below has an owner: a fixing PR (mine or external), or a full-effort fix task
The other CIDB Session id: cron:our-pr-ci-monitor:20261117-010021 |
eb2ca90
Related: #131313
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Not required.
Description
The test added by #131313 expects the left side of
f JOIN d ... WHERE d.v = 3to reportrows 1.00 thousand. Under some layouts from the CI's randomized MergeTree settings it reportsrows 999.00, and the first two rows of the reference become1 0. It fails deterministically with:No related open issue found.
The counter is right. With
query_plan_join_shard_by_pk_ranges(on by default) both tables are split into primary-key ranges, each with its own hash table, andJoiningTransformdoes not read the left rows of a range whose hash table is empty (alwaysReturnsEmptySet). With granularity 998 the last range isk = 999, which has nod.v = 3row, so 999 left rows reach the join. The query result is unchanged.The test now sets
query_plan_join_shard_by_pk_ranges = 0, next to theenable_join_runtime_filters = 0it already has for the same reason. TheEXPLAIN ANALYZEhelp text inParserExplainQuery.cppgets one sentence saying the same thing about sharded joins as it already says about runtime filters.Validation: on the unedited test, the command above fails, and so do two 32-thread layouts (granularity 7, and 8192 with
index_granularity_bytes = 1024) when all 32 threads are used. With the change they pass, as does a sweep of granularity 7, 50 and 990-998 at 2 and 32 threads (22/22 pass, 20/22 failed before), and 50/50 randomized runs.Workflow [PR]
Sync PR [sync-upstream/pr/132149]
Version info
26.11.1.2843-master(included in26.11and later)