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 in26.11and later)
<!-- ch-version-info:end -->