Keep parallel replicas for additional_table_filters under plan-based parallel replicas #127058

Merged
devcrafter opened 8:39pm on October 20, 2026 wanted to merge 1 ฮ” into clickhouse/clickhouse master from
pr-plan-based-additional-table-filters
Reviewing
33 fewer changed lines
(83% less) vs GitHub
This saves about 145.3 hours per year vs conventional diff tools
devcrafter authored
of work between October 20 and October 30
Diff Delta:
1
About 1 Diff Delta/hour
Classified as:  General

devcrafter's Description of Work

A query with additional_table_filters silently loses parallel replicas, because a follower
re-resolves the setting's keys against its own current database and can match the wrong table. The
check that disables it exempts serialize_query_plan = 1, where the initiator lowers the filter into
a FilterStep and ships the plan. Plan-based parallel replicas ships the plan the same way -
ReadFromParallelReplicas passes QueryProcessingStage::QueryPlan and the plan itself to the remote
executor, whatever serialize_query_plan says - so the follower re-resolves nothing there either, and
the check now exempts it too.

Measured with parallel_replicas_local_plan = 0, so every row comes from a replica reading the
shipped fragment: SELECT count() over 50000 rows with additional_table_filters = {'t': 'y < 5'}
returns 25000, and ParallelReplicasQueryCount goes from 0 to 1. The new test asserts both, and fails
on master for the second one.

Related: https://github.com/ClickHouse/ClickHouse/pull/112351

Changelog category (leave one):


  • Improvement

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

Queries using additional_table_filters no longer lose parallel replicas when
parallel_replicas_plan_based is enabled.

๐Ÿค– Generated with Claude Code


Workflow [PR]
Sync PR [sync-upstream/pr/127058]
<!-- CI automatic block end :ci_links: -->

Version info


  • Merged into: 26.11.1.984-master (included in 26.11 and later)
    <!-- ch-version-info:end -->

3 total changed files
(2 files ignored)
Loading changes...
Youโ€™ve reached the end
The diff well is dry.