Repository navigation
PR: use serialized query plan (part 1) - #88696
Merged
Merged
Conversation
Contributor
1 task
- JOINs with the same MT table
devcrafter
marked this pull request as ready for review
February 18, 2026 08:44
Contributor
There was a problem hiding this comment.
Pull request overview
This PR is the first part of switching distributed/parallel-replicas execution to use a serialized QueryPlan (behind serialize_query_plan), and updates several stateless tests to be more robust/cleanup state.
Changes:
- Add caching APIs to
QueryPlanserialization and use cached bytes when sending query plans over the wire. - Propagate a
QueryPlanthrough parallel-replicas remote execution paths and preserve context lifetime for storage resolution. - Adjust stateless tests and expected
EXPLAINoutput to coverserialize_query_planbehavior.
Reviewed changes
Copilot reviewed 22 out of 22 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/queries/0_stateless/03641_analyzer_issue_85834.sql | Add row policy cleanup and drop table at end to avoid test pollution. |
| tests/queries/0_stateless/03303_distributed_explain.sql | Extend distributed EXPLAIN coverage for serialize_query_plan and parallel replicas. |
| tests/queries/0_stateless/03303_distributed_explain.reference | Update expected EXPLAIN output for new sections. |
| tests/queries/0_stateless/03255_parallel_replicas_join_algo_and_analyzer_4.sh | Add defensive DROP TABLE IF EXISTS before creating tables. |
| tests/queries/0_stateless/03093_reading_bug_with_parallel_replicas.sql | Remove settings lines / minor cleanup. |
| tests/queries/0_stateless/02998_analyzer_prewhere_report.sql | Make table name unique and add DROP TABLE IF EXISTS preamble. |
| src/QueryPipeline/RemoteQueryExecutor.h | Add optional QueryPlan parameter to support query-plan stage remotely. |
| src/QueryPipeline/RemoteQueryExecutor.cpp | Wire QueryPlan through constructors and send it when present. |
| src/Processors/QueryPlan/resolveStorages.cpp | Preserve context lifetime in resolved reading plans; propagate parallel-replicas intent via context setting. |
| src/Processors/QueryPlan/Serialization.cpp | Add QueryPlan cached-serialization helpers (ensureSerialized/getSerializedData/isSerialized). |
| src/Processors/QueryPlan/QueryPlan.h | Store cached serialized plan bytes in QueryPlan. |
| src/Processors/QueryPlan/ReadFromTableStep.h / .cpp | Add use_parallel_replicas bit and serialize/deserialize it. |
| src/Processors/QueryPlan/ReadFromRemote.h / .cpp | Pass QueryPlan through parallel remote replicas and use it for distributed plan description. |
| src/Processors/QueryPlan/ParallelReplicasLocalPlan.h / .cpp | Split out remote-plan creation and mark reads as parallel-replicas capable. |
| src/Planner/findParallelReplicasQuery.cpp | Relax follower restriction when serialize_query_plan is enabled. |
| src/Planner/PlannerJoinTree.cpp | Ensure PREWHERE outputs include columns needed by row-policy/additional filters in logical plan. |
| src/Interpreters/ClusterProxy/executeQuery.cpp | Build and pass a remote query plan for parallel replicas when serialization is enabled. |
| src/Interpreters/ActionsDAG.cpp | Fix set registry pointer handling when deserializing constant sets. |
| src/Client/Connection.cpp | Send cached serialized query plan bytes when available. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fast tests CI run (with enabled
serialize_query_plan) and distributed plan run are passing. Next steps are enabling more tests and removing unnecessary conversion between internal query representations (AST, query tree, query plan). Continue in #97261Changelog category (leave one):
Version info
26.2.1.979