Repository navigation
Make join runtime filters non-experimental - #117383
Conversation
|
Workflow [PR], commit [1358dd5] Summary: ✅
AI ReviewSummaryThis PR promotes the join runtime filter settings family in Findings
Tests
Final VerdictNot ready: the PR still promotes LLVM Coverage ReportMeasured on commit 1358dd5.
Changed lines: Changed C/C++ lines covered: 49/49 (100.00%) · Uncovered code |
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Compile time of recompiled translation units8 translation units recompiled, 20 s compile time in total, 8 of them have a recent master baseline. |
|
Triggered test re-run, due to unrelated failure: 03707_autopr_unsupported_cases reproducible fail |
63cd647 to
9e39419
Compare
…o_join` The branch was force-pushed after 63cd647, which dropped the documentation sentence and the regression test, so the AI review correctly pointed out that the promised contract is not in the tree. This restores both. `rewrite_in_to_join` is only consumed on the analyzer path, so with `enable_analyzer = 0` it is a no-op. Making the old analyzer throw is not an option: the setting is an optimization hint, and rejecting every `x IN (subquery)` under the old analyzer would break existing queries for no benefit. Instead this follows the existing convention for production-tier analyzer-only settings: the description states that the setting takes effect only with `enable_analyzer = 1`, and the new test `05109_rewrite_in_to_join_old_analyzer` pins the documented contract - with the old analyzer the query is accepted, `IN` is evaluated as usual and no `JOIN` appears in the plan, while with the analyzer the very same query is rewritten and the plan does contain a `JOIN`. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…e master merge `05109` was taken by `05109_lcm_wide_integer_sign` on master. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
|
🕵 Both CI reds on
@groeneai, please confirm #118486 covers the TSan race above; if it needs more work, a separate PR is fine — no fix is expected in this one. I merged |
| @@ -9182,40 +9182,42 @@ Takes effect only together with `enable_cascades_optimizer = 1` and `make_distri | |||
| )", BETA) \ | |||
| DECLARE(Bool, enable_join_runtime_filters, true, R"( | |||
There was a problem hiding this comment.
The tier flip in Settings.cpp is only half of this PR's contract. The new stateless test proves the analyzer-only no-op for rewrite_in_to_join, but it still does not prove that the promoted runtime-filter settings now surface as Production (or remain writable under allow_feature_tier = 3), and SettingsChangesHistory.cpp is not updated to record when this family graduated. Similar tier-only changes already add both a focused system.settings tier test (for example 05046_distributed_plan_private_preview_tier.sql) and no-op history records (for example enable_parallel_replicas in SettingsChangesHistory.cpp). Please add the matching history entries plus a small tier regression test for the promoted runtime-filter settings.
There was a problem hiding this comment.
🕵 Done, both parts.
Settings history. SettingsChangesHistory.cpp now records the graduation under the current 26.9 block, one no-op entry per promoted setting (previous value equal to the new one, so compatibility restores nothing — the tier is metadata, the defaults did not move), following the enable_parallel_replicas precedent:
{"enable_join_runtime_filters", true, true, "The JOIN runtime filters became a Production tier feature."},
{"join_runtime_filter_exact_values_limit", 10000, 10000, ...},
{"join_runtime_bloom_filter_bytes", 512_KiB, 512_KiB, ...},
{"join_runtime_bloom_filter_hash_functions", 3, 3, ...},
{"join_runtime_filter_pass_ratio_threshold_for_disabling", 0.7, 0.7, ...},
{"join_runtime_filter_blocks_to_skip_before_reenabling", 30, 30, ...},
{"join_runtime_bloom_filter_max_ratio_of_set_bits", 0.7, 0.7, ...},
{"join_runtime_filter_min_probe_rows", 1000, 1000, ...},
{"enable_join_runtime_filters_index_analysis", false, false, ...},
{"rewrite_in_to_join", false, false, "The rewrite of `x IN subquery` to a JOIN became a Production tier feature."},
Tier test. 05137_join_runtime_filters_production_tier asserts the exact name/tier pairs in system.settings for the whole family (including the two members that were already Production) and that none of them is left in a gated tier — modelled on 05046_distributed_plan_private_preview_tier.
On the allow_feature_tier = 3 suggestion: allow_feature_tier is a server setting, so a plain stateless .sql test cannot SET it. The tier assertion is the equivalent guard — the readonly constraint is derived from the tier, so pinning the tier pins the writability.
Verified locally against a build of this branch: 03999_stateless_settings_history (which checks that the newest recorded value matches the compiled default) is green with the new entries, and 05137_join_runtime_filters_production_tier, 03257_setting_tiers and the old-analyzer test all pass. The old-analyzer test is now 05138_rewrite_in_to_join_old_analyzer — 05136 was taken on master by 05136_interpolate_clause_query_parameters.
There was a problem hiding this comment.
The history half is on the current head, but the tier-test half from your reply still is not. At src/Core/Settings.cpp:9187-9216 and src/Core/SettingsChangesHistory.cpp:65-73, the branch still only changes the setting metadata/history; the current PR diff contains no tests/queries/0_stateless/05137_join_runtime_filters_production_tier.{sql,reference} at all. So this promotion is still unpinned: nothing in the branch proves these settings now surface as Production or remain writable under a production-only allow_feature_tier.
|
Confirmed: #118486 covers that race. I matched it by frame, not by STID. On your #118486 deletes that lambda and the No separate PR is needed, on measurement. Anchored on the write frame ( I did check the partition-key manifest-pruning route ( #118486 is open and mergeable. Its only red is |
…with a test
Address review: the tier flip in `src/Core/Settings.cpp` was not recorded in
the versioned settings history and was not covered by a direct regression test.
Add no-op records (previous value equal to the new value, so `compatibility`
does not restore anything) under the current `26.9` block for the ten settings
this change promotes, following the precedent of
`{"enable_parallel_replicas", false, false, "Parallel replicas with read tasks
became the Beta tier feature."}`, and add
`05137_join_runtime_filters_production_tier`, which asserts the exact setting
names and their `Production` tier in `system.settings` and that none of them is
left in a gated tier.
Verified locally: `03999_stateless_settings_history` (which checks that the
newest recorded value matches the compiled default),
`05137_join_runtime_filters_production_tier`, `03257_setting_tiers` and
`05136_rewrite_in_to_join_old_analyzer` all pass, and the `cpp`,
`functional_tests_check`, `test_numbers_check`, `whitespace_check` and
`clickhouse_spelling` style checks are green.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…rimental-rtfilter
`05136` was taken on `master` by `05136_interpolate_clause_query_parameters`, which the base merge brought in. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
|
I'll add label |
| DECLARE(Bool, enable_join_runtime_filters_index_analysis, false, R"( | ||
| Run a second pass index analysis (via use_skip_indexes_on_data_read) to prune granules on LHS of a join. | ||
| )", EXPERIMENTAL) \ | ||
| )", 0) \ |
There was a problem hiding this comment.
Promoting enable_join_runtime_filters_index_analysis to Production overstates the supported surface. The setting's contract here is that it prunes the left-side MergeTree read, but the descriptors that make that second-pass pruning happen are still explicitly dropped when the read step is rebuilt for distributed or parallel-replica execution (src/Processors/QueryPlan/ReadFromMergeTree.h:561-566, src/Processors/QueryPlan/ReadFromMergeTree.cpp:6547-6552). So with make_distributed_plan = 1 or worker-side plan-based parallel replicas, enabling this setting silently degrades to plain runtime filters instead of doing the advertised index analysis. Please either keep this specific setting gated for now, or make the unsupported modes explicit by rejecting them or documenting and testing a no-op contract.
There was a problem hiding this comment.
🕵 Confirmed and fixed in a follow-up: #119041
You are right that the descriptors are dropped, and I measured what that costs. Summing the profile events of every query sharing the initiator's initial_query_id for the same JOIN (2000-row fact table, index_granularity = 16, 64 matching keys):
| mode | RuntimeFiltersCreated |
RuntimeFilterRowsChecked |
RuntimeFilterGranulesConsidered |
RuntimeFilterGranulesDropped |
|---|---|---|---|---|
| local | 1 | 64 | 125 | 121 |
make_distributed_plan = 1 |
0 | 0 | 0 | 0 |
| parallel replicas | 3 | 6000 | 0 | 0 |
| plan-based parallel replicas | 1 | 2000 | 0 | 0 |
So under parallel replicas it does degrade to exactly the plain row-level runtime filter you describe, and under make_distributed_plan this shape builds no runtime filter at all — in every case the granule pruning is a silent no-op, while the results are identical.
Of the three options you list I took the third. Rejecting the unsupported modes is not viable for the same reason as for rewrite_in_to_join: the setting is an optimization hint, and throwing because the left side happens to be read remotely would break working queries for no benefit. Keeping it gated would hide a feature that is fully supported on the single-node path. So the supported surface is now stated where a user looks for it: the description ends with "Takes effect only when the left side of the join is read locally … the granule pruning does not happen with parallel replicas (enable_parallel_replicas = 1) or with a distributed query plan (make_distributed_plan = 1). In those modes the setting is a no-op: the query returns the same result and the JOIN runtime filter itself behaves exactly as it does with this setting disabled, only the granule pruning is lost."
The new test 05153_join_runtime_filters_index_analysis_distributed_noop pins that contract in all four modes above — the local control asserts pruning really happens, the three rebuilt-read modes assert it does not, and all four assert the same rows — so the set of modes where the setting does nothing can no longer grow unnoticed. The three code sites that drop the descriptors (ReadFromMergeTree.h, serialize, and the isParallelReadingFromReplicas guard in initializePipeline) now point at the description and the test. Propagating the descriptors to worker plans, so the optimization applies there too, remains the follow-up.
…_analysis `enable_join_runtime_filters_index_analysis` became a Production tier setting in ClickHouse#117383, but its second-pass granule pruning only happens for a left side that is read locally. The descriptors that drive it are attached to `ReadFromMergeTree` during query plan optimization and are carried by neither `clone` nor `serialize`/`deserialize`, and `initializePipeline` skips the pruning outright under parallel replicas. So with `make_distributed_plan = 1` or with parallel replicas the setting silently does nothing. Making those modes throw is not an option: the setting is an optimization hint, and rejecting a JOIN because its left side is read remotely would break working queries for no benefit. Instead the supported surface is now stated where a user looks for it, following the convention of the other production-tier settings that only apply to a subset of execution modes: the setting description says that the pruning does not happen with `enable_parallel_replicas = 1` or `make_distributed_plan = 1`, that the results are unchanged there, and that the JOIN runtime filter itself is unaffected. The new test `05153_join_runtime_filters_index_analysis_distributed_noop` pins that contract in all four modes: a local read prunes granules (`RuntimeFilterGranulesConsidered`/`Dropped` are nonzero), a distributed query plan, coordinator-driven parallel replicas and plan-based parallel replicas prune none, and all four return the same rows. Follows up on the review of ClickHouse#117383: https://github.com/ClickHouse/ClickHouse/pull/117383/changes#r3959601132 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
This was some leftover from earlier this year.
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Join runtime filter settings are now production-tier (previously Experimental).
Workflow [PR]
Sync PR [sync-upstream/pr/117383]
Version info
26.9.1.1039(included in26.9and later)