Skip to content

Add fallback to local execution when a plan step does not support distributed execution - #116487

Merged
antoniofilipovic merged 36 commits into
masterfrom
afilipovic-fallback-local-exec-distributed-plan-failure
Sep 12, 2026
Merged

antoniofilipovic merged 36 commits into
masterfrom
afilipovic-fallback-local-exec-distributed-plan-failure

Conversation

@antoniofilipovic

@antoniofilipovic antoniofilipovic commented Aug 26, 2026 •

Copy link
Copy Markdown
Member

Issue

When enabling make_distributed_plan=1, some plans which could not be distributed would throw exception SUPPORT_IS_DISABLED. Some which did not throw the exception would silently be rewritten to the local node execution. The checks producing that exception were scattered across the optimizer, some of them firing mid-transform, after exchanges were already in the plan, when there was no way back.

What this PR does:

For queries planned by the analyzer, the decision is made up front by InterpreterSelectQueryAnalyzer::applyDistributedPlanFallbackIfNeeded, which propagates an applied fallback into the interpreter context and into every query tree node context. This becomes needed as second-pass index analysis builds IN-subquery sets reading make_distributed_plan live from the contexts, and if not cleared from the context on fallback, we have a plan which should be executed on single node, but has IN-subquery sets built as for distributed step.

On rejection the reason is logged and the query executes on the initiator instead of throwing. The new distributed_plan_fallback_to_local_execution=0 restores the exception; since make_distributed_plan means "distribute this query", setting it to 0 doubles as a per-query assertion that the query really was distributed.

Also, there is no anymore silent fallback in convertToDistributed. If we decide for distributed plan, and optimization pass introduces a node which is not serializable, exception is thrown. Reason is that optimization pass could know what can be done with the plan to keep it distributable. Checks in the optimize pass already exist, so it is easy to guard against wrong plan for distributed mode.

Example of silent fallback

There were tests which expected lazy materialization to be distributed, but it can't be and it was not so it needed a fix as part of this for make_distributed_plan=1. Lazy materialization runs after static decision point and after inserting exchanges. Lazy materialization code expected format where exchanges would be inserted so lazy materialization is not applied, as it checks for specific query shape which does not support Exchange node. However, the FINAL PREWHERE ... LIMIT shape gets no exchange at all and for distributed query non-serializable JoinLazyColumnsStep is inserted into a plan. master branch hid this by silently running such plans on one node and making a silent fallback. Lazy materialization and lazy FINAL are now skipped while building a distributed plan, however every fragment is again re-optimized by the executor with make_distributed_plan = 0, so the worker applies the lazy materialization optimization to its own fragment.

Tests that pinned the old throws keep their coverage via distributed_plan_fallback_to_local_execution = 0 per query.

Closes: #113687

Changelog category (leave one):

  • Improvement

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

When make_distributed_plan is enabled in the case there is no viable option for distributed plan, the fallback to local execution happens.


Workflow [PR]
Sync PR [sync-upstream/pr/116487]

Version info

  • Merged into: 26.9.1.1280 (included in 26.9 and later)

@groeneai groeneai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Read the whole diff. One thing blocks merge outright, one merge hazard would revert three merged features, and the setting does not yet cover the half of #113687 a user is most likely to hit. The move of the check before optimization itself looks sound, and I checked that rather than just asking.

1. The base predates WITH ROLLUP / WITH CUBE / GROUPING SETS support, and the rewritten predicates still reject all three

Merge base is e3da288d (2026-08-18). Master gained since then:

  • ba946f6 "Serialize RollupStep so make_distributed_plan supports WITH ROLLUP" (PR 114950), which dropped RollupStep and CubeStep from planHasUnsupportedDistributedStep, plus a768aab "Keep only the WITH TOTALS case in the gate test, ROLLUP and CUBE are supported now", which renamed 04308_distributed_totals_rollup_cube_not_distributed.sql to 04308_distributed_totals_not_distributed.sql.
  • 6bfccba "Support WITH CUBE and GROUPING SETS in make_distributed_plan". On master the only GROUPING SETS rejection left in tryMakeDistributedAggregation is the in-order one (makeDistributed.cpp:596-601); otherwise it selects PartialAggregation.
  • 5f7a67b (PR 115426) for the Cascades two-phase GROUPING SETS split.

This branch keeps typeid_cast<const RollupStep *> and typeid_cast<const CubeStep *> in planHasUnsupportedDistributedStep, rejects isGroupingSets unconditionally in hasAggregationUnsupportedStepForDistributed, and edits the pre-rename 04308 file, which no longer exists. Merging master conflicts in exactly those places, and taking this branch's side reverts the three commits and breaks 04897_distributed_plan_rollup, 04899_distributed_plan_cube and 04900_distributed_plan_grouping_sets. All three use the legacy path with make_distributed_plan = 1 and pin an EXPLAIN arm in their reference, so they fail on a changed plan rather than on an exception.

I would merge master first: makeDistributed.cpp has 27 and optimizeTree.cpp 73 commits on master since this base.

2. distributed_plan_fallback_to_local_execution does not cover rejections decided after optimization

The description says "log the reason and execute the query on the initiator instead of throwing an exception", but the fallback is decided only at the top of QueryPlan::optimize, before the passes. Three SUPPORT_IS_DISABLED throws stay reachable at the default 1:

  • QueryPlan.cpp:934, when the post-optimization hasUnsupportedStepRemoteExecution(*root, false) rejects a plan that by then carries logical exchanges.
  • assertFragmentSerializable, QueryPlan.cpp:85, called at :996.
  • checkStepSupportedByCascades through checkCascadesSupported, optimizeTree.cpp:395, which runs inside the second pass.

That is reachable rather than theoretical, because the only two conditional isSerializable overrides in the tree both read state the optimizer writes:

  • AggregatingStep::isSerializable is sort_description_for_merging.empty() && !explicit_sorting_required_for_aggregation_in_order (AggregatingStep.h:125-128), and sort_description_for_merging is filled by optimizeAggregationInOrder (optimizeTree.cpp:454), after the pre-pass has already accepted the plan.
  • SortingStep::isSerializable is (type == Type::Full || type == Type::FinishSorting) && scatter_partitions == 0 (SortingStep.h:166-169), and type and scatter_partitions are set by applyOrder (optimizeTree.cpp:773).

None of this is a regression, the same queries throw today. But the cases decidable before optimization are largely the ones a user can already see in the query text (WITH TOTALS, PASTE JOIN, GLOBAL IN, STREAM), while these are not, so the feature currently misses the part that is hard to predict. Either honour the fallback at the post-optimization site as well, which needs a copy of the pre-optimization plan to re-optimize with make_distributed_plan = false, or narrow the setting description to say it covers only rejections decided before optimization.

3. Moving the check before optimization is sound, for the record

I checked whether any other step class can make the pre-pass stricter than the post-pass. Of the non-serializable steps the planner builds before QueryPlan::optimize, only CommonSubplanStep and CommonSubplanReferenceStep are removed during optimization, by materializeQueryPlanReferences and optimizeUnusedCommonSubplans (optimizeTree.cpp:268-277), which is exactly what allow_subplan_placeholders whitelists. DelayedCreatingSetsStep is serializable (CreatingSetsStep.h:97); DelayedMaterializingCTEsStep, ReadFromRemote and ReadFromParallelRemoteReplicasStep all survive optimization on this path, so both checks see them either way. Localhost-shard inlining happens in SelectStreamFactory::createForShardImpl at plan build time, not in a pass. Worth stating that invariant next to allow_subplan_placeholders, because the whitelist has to be revisited the first time a pass starts removing some other non-serializable step.

4. Nothing exercises the new default

All seven touched test files add distributed_plan_fallback_to_local_execution = 0, so every arm keeps the old behaviour and the default-on path has no coverage at all. Two arms would fix that: one that takes the fallback and compares its result against the same query with make_distributed_plan = 0, and one asserting a supported query is still distributed (EXPLAIN distributed = 1, as 04671_make_distributed_plan_join_to_in_disabled does). The second matters more than it looks. With the fallback on, an over-rejection stops being an error and becomes a silent single-node run, so a plan-shape assertion is the only thing left that can catch one.

Cleanup

  • SettingsChangesHistory.cpp: the entry is in the 26.8 block. Master is 26.9 and already has a 26.9 block at line 44, so it needs moving when you merge.
  • QueryPlan.cpp:22 and :24 add TotalsHavingStep.h and Optimizations/Utils.h; neither is used in the file.
  • QueryPlan.cpp:822-824 declare planHasUnsupportedDistributedStep, planHasInOrderAggregation and verifyDistributedAggregation, none of which is used there. planHasInOrderAggregation has its definition deleted by this PR and a second stale declaration in optimizeTree.cpp; verifyDistributedAggregation does not exist anywhere in the tree.
  • hasAggregationUnsupportedStepForDistributed can take a const QueryPlan::Node &, and the aggregating_step && at makeDistributed.cpp:256 is already guaranteed by the early return above it.
  • Typos and spacing: "beforhand", "a aggregating step", the double space in the traversePlanForUnsupportedDistributedStep declaration, and the added blank lines in QueryPlan.h and QueryPlanOptimizationSettings.h.
  • The new names read backwards at the call sites: if (auto res = isReadFromMergeTreeSupportedForDistributed(step); res.has_value()) means the read is not supported. findUnsupported... would match what the returned value means.

Comment thread src/Processors/QueryPlan/QueryPlan.cpp Resolved
Comment thread src/Processors/QueryPlan/QueryPlan.h Resolved
@antoniofilipovic
antoniofilipovic force-pushed the afilipovic-fallback-local-exec-distributed-plan-failure branch from ad39ed5 to 0799b70 Compare August 27, 2026 10:12
@clickhouse-gh

clickhouse-gh Bot commented Aug 27, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [b1cb504]

Summary: ✅


AI Review

Summary

This PR centralizes the make_distributed_plan fallback decision and fixes several places where a locally-fallen-back plan kept distributed state in its contexts. The main direction looks right, but the propagation is still incomplete: some analyzer-built plans are still optimized or executed after a local fallback with make_distributed_plan = 1 left behind in captured contexts, so they can re-enter the distributed PreparedSets path on what should already be a local plan.

Missing context / blind spots
  • ⚠️ The current Praktika report reachable from the PR comment exposed only Build profile diff, so I could not use CI to validate the touched distributed-plan stateless or integration tests on this head.
Findings

⚠️ Majors

  • [src/Storages/buildQueryTreeForShard.cpp:629-631, src/Storages/StorageDistributed.cpp:1366-1377] These callers still extract an analyzer plan and then let buildQueryPipeline or optimize decide the fallback on a settings snapshot only. When such a plan falls back locally, later IN (SELECT ...) set analysis still reads make_distributed_plan = 1 from the captured query-tree contexts and plans the set as distributed. That is the same context leak the PR description says this change fixes. Suggested fix: call InterpreterSelectQueryAnalyzer::applyDistributedPlanFallbackIfNeeded() before extractQueryPlan() in every caller that later optimizes or builds the extracted plan, or otherwise flip the captured context tree when the fallback applies.
  • [src/Storages/StorageMerge.cpp:795-804] ReadFromMerge child plans now call applyDistributedPlanFallbackToLocal, but only on QueryPlanOptimizationSettings. If an analyzer-built child falls back locally for any reason other than the explicit queryHasSubquerySets() branch, modified_context and the child query-tree contexts still keep make_distributed_plan = 1; pushed-down IN (SELECT ...) filters then hit the same stale-context bug during child.plan.optimize(). Suggested fix: apply the fallback on the child InterpreterSelectQueryAnalyzer before extractQueryPlan(), or propagate the false setting through the child context tree when applyDistributedPlanFallbackToLocal() returns true.
Final Verdict

Changes requested.

LLVM Coverage Report

Measured on commit b1cb504.

Metric Baseline Current Δ
Lines 89.00% 89.00% +0.00%
Functions 91.80% 91.80% +0.00%
Branches 81.30% 81.30% +0.00%

Changed lines: Changed C/C++ lines covered: 374/431 (86.77%) · Uncovered code

Full report · Diff report

@clickhouse-gh clickhouse-gh Bot added the pr-improvement Pull request with some product improvements label Aug 27, 2026
@antoniofilipovic

Copy link
Copy Markdown
Member Author

@groeneai please check the code again.

  1. The base predates WITH ROLLUP / WITH CUBE / GROUPING SETS support, and the rewritten predicates still reject all three
    Fixed when merged with master.
  2. re: distributed_plan_fallback_to_local_execution does not cover rejections decided after optimization

In general, the idea for this PR is to have static checks in one place to verify if plan can be rewritten. If there are later some optimization steps which introduce some issues which we cannot detect on unoptimized plan, we can go with approach to try make distributed plan, if the exception happens we then fall back on the normal plan. This would require having copy of the plan nodes before rewrite. I think this is in general good approach, but seems unnecessary for now as we gate in the optimization code steps which would produce unsupported distributed plan.

Direct answers
sort_description_for_merging is filled by optimizeAggregationInOrder (optimizeTree.cpp:454), after the pre-pass has already accepted the plan. - yes but this is gated by !make_distributed_plan check the issue cannot happen.

For SortingStep, convertToFinishSorting produces a type that isSerializable accepts (SortingStep.h:168), and the non-serializable write (convertToScatteredFullSort, SortingStep.h:146) only happens in optimizeParallelFullSortingMergeJoin, which is skipped under make_distributed_plan (optimizeTree.cpp:776).

  1. Nothing exercises the new default
    Added the new test.

@groeneai groeneai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-checked all of it at 6c521eb. Approving. One thing will fail Style check, the rest is cosmetic.

Verified fixed:

  • The merge base is now 573230b (2026-08-26), which contains ba946f6, 6bfccba, a768aab and 5f7a67b, so WITH ROLLUP / WITH CUBE / GROUPING SETS support is no longer reverted. RollupStep and CubeStep are gone from the unsupported-step check, isGroupingSets is a LOG_TRACE rather than a rejection, and the diff edits the post-rename 04308_distributed_totals_not_distributed.sql. That was the blocker.
  • Post-optimization rejections (item 2). The two SUPPORT_IS_DISABLED throws left in convertToDistributed now carry the "the plan is already shaped for distribution, so fail closed" rationale, and the passes that could flip serializability after the decision do not run under make_distributed_plan (aggregation_in_order, lazy materialization, optimizeJoinByShards). Good enough for me on the reachable paths.
  • Coverage at the new default (item 4). 05045 runs three arms at the default and asserts DistributedPlanLocalExecution = 0 on a fallen-back query, and 04652 asserts > 0 on one that must still distribute. That is both directions.
  • makeDistributed.cpp:97: the helper returns step pointers now, so the serializable: Sorting composition is gone. The max_rows_to_group_by rejection names the setting again, the children.size() != 1 return is out, ERROR OLD: is gone, the SettingsChangesHistory entry sits in the 26.9 block, the commented-out validateSetsForDistributedPlan is a real call at QueryPlan.cpp:907, and the QueryPlanOptimizationSettings.h include is out of QueryPlan.cpp.

Still open:

  • makeDistributed.cpp:266 is a line of four spaces, left behind by removing the guard. check_cpp.sh check 06b is grep -Hn ' $' over src/, and master's copy of the file is clean, so this fails Style check as it stands.
  • QueryPlan.h:21 still includes QueryPlanOptimizationSettings.h next to the forward declaration at :45. All three uses are by const reference, and 161 files under src/ include QueryPlan.h.
  • QueryPlan.cpp:824-825 declares planHasUnsupportedDistributedStep and verifyDistributedAggregation. Neither is called there, and verifyDistributedAggregation has no definition anywhere in the tree.
  • "Is this a aggregating step?" appears at both makeDistributed.cpp:240 and :631.
  • isReadFromMergeTreeSupportedForDistributed returns a message when the read is not supported, so if (auto maybe_unsupported = ...; maybe_unsupported.has_value()) at :353 reads inverted.
  • The setting is declared with the default tier while its own text says it applies only under the experimental make_distributed_plan; the neighbouring distributed_plan_* settings are EXPERIMENTAL.

One thing worth a thought before the default flip lands, not necessarily in this PR. On this branch 115 stateless tests set make_distributed_plan; 3 of them assert plan shape with EXPLAIN distributed and 3 assert the execution mode through DistributedPlanLocalExecution (04746, 04652, 05045). The rest assert results only, so with the fallback on by default an over-rejection in the new pre-pass stops being a red and becomes a silent single-node green across most of that corpus. Pinning distributed_plan_fallback_to_local_execution = 0 in the stateless test profile would keep the corpus loud while the product default stays 1; 05045 would then pin = 1 on its three fallback arms. Your call.

Comment thread src/Processors/QueryPlan/QueryPlan.cpp Resolved
@groeneai

Copy link
Copy Markdown
Collaborator

Your two notes on the lazy-materialization gate and on removing the convertToDistributed fallback both answer it; nothing further from me, the approval stands at 6c521eb.

One thing that is easy to misread in the check list: that run is void, not one red check among many green ones. result_pr.json for 6c521eb has 148 DROPPED against 5 OK, and the only two that did real work are Fast test and Build (arm_tidy). Everything that exercises this PR is in the dropped set: all four distributed plan stateless jobs, all four Integration tests (arm_binary, distributed plan) shards, and every build other than arm_tidy. The only failure in the run is the one trailing-whitespace line at makeDistributed.cpp:266 (cpp sub-check, Failures: 1/15), so clearing it is what buys the first real test signal for the default flip.

@antoniofilipovic

Copy link
Copy Markdown
Member Author

@groeneai answer on the last comment:

One thing worth a thought before the default flip lands, not necessarily in this PR. ...

Currently, setting distributed_plan_fallback_to_local_execution = 0 means "this query must be distributed", and a lot of harmless queries can't be: SELECT '-- label', numbers(10), even a plain SELECT count() FROM t. Also, master silently ran any query which can't be distributed on the one node, so none of these tests were ever written expecting a throw and the test 04652_lazy_materialization_replace_node_header_order.sql is the proof.

So I'd rather add = 0 to the individual queries that should be distributed, which makes them fail loudly with the offending step named. Doing that in a follow-up PR, one query at a time, since each needs a check first.

Comment thread src/Processors/QueryPlan/QueryPlan.cpp Resolved
@clickhouse-gh

clickhouse-gh Bot commented Aug 27, 2026 •

Copy link
Copy Markdown
Contributor

Build profile diff (arm_release)

Comparing b1cb504d5 with master a61a24c6a (stripped binary size, per-symbol sizes and ThinLTO time; compile times per translation unit against the most recent warmup build that recompiled it).

✅ No significant changes.

Binary sizes

programs/clickhouse-stripped: smaller than the master baseline by the known offset between the two builds, so the difference is not shown. A delta that differs from the offset by more than 50% of it is shown, in either direction.

The official master build is compiled with -g and a pull request build is not, and XRay counts debug instructions towards its instrumentation threshold, so master instruments thousands of functions more and its binary is ~0.4% larger no matter what the pull request does.

Compile time of recompiled translation units

256 translation units recompiled, 2138 s compile time in total, 256 of them have a recent master baseline.

Job report

Comment thread src/Processors/QueryPlan/QueryPlan.cpp Resolved
Comment thread src/Processors/QueryPlan/QueryPlan.cpp Resolved
Comment thread src/Processors/QueryPlan/QueryPlan.cpp Resolved
@antoniofilipovic
antoniofilipovic marked this pull request as ready for review August 31, 2026 13:43
@antoniofilipovic antoniofilipovic self-assigned this Aug 31, 2026
@davenger davenger self-assigned this Aug 31, 2026
@antoniofilipovic antoniofilipovic removed their assignment Aug 31, 2026
@antoniofilipovic
antoniofilipovic force-pushed the afilipovic-fallback-local-exec-distributed-plan-failure branch from 0c881f0 to 3944529 Compare September 3, 2026 08:52
Copilot stopped work on behalf of antoniofilipovic due to an error September 3, 2026 09:23
@antoniofilipovic
antoniofilipovic force-pushed the afilipovic-fallback-local-exec-distributed-plan-failure branch from 14f96c9 to 6e2ae2e Compare September 4, 2026 09:59
Comment thread src/Processors/QueryPlan/QueryPlan.cpp Resolved
@clickhouse-gh clickhouse-gh Bot added the comp-query-optimizer Query plan optimization: physical plan steps, plan-level rewrites and optimizations (QueryPlan pa... label Sep 4, 2026
@antoniofilipovic
antoniofilipovic force-pushed the afilipovic-fallback-local-exec-distributed-plan-failure branch from 0d8ff04 to 20d8a51 Compare September 10, 2026 14:12
return std::move(planner).extractQueryPlan();
}

void InterpreterSelectQueryAnalyzer::applyDistributedPlanFallbackIfNeeded()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This only fixes the analyzer paths that go through InterpreterSelectQueryAnalyzer::buildQueryPipeline. There are still callers that take the raw analyzer plan and drive it themselves, for example executeSubqueryNode in src/Storages/buildQueryTreeForShard.cpp:598-631 and StorageDistributed::getFilterFromQuery in src/Storages/StorageDistributed.cpp:1366-1377.

Those paths never call applyDistributedPlanFallbackIfNeeded(), and QueryPlan::buildQueryPipeline / plan.optimize only flip the QueryPlanOptimizationSettings snapshot, not the query-tree contexts the already-built steps captured. So if one of those plans falls back locally (for example a GLOBAL IN subquery whose inner SELECT is not distributable and also contains a nested IN), second-pass index analysis still sees make_distributed_plan = 1 in the captured contexts and goes through the distributed PreparedSets path on what is supposed to be a local fallback. That is the same context leak the PR description says this change fixes.

I would either move the context flip into a truly shared path, or audit these out-of-band analyzer callers so they call this helper before extracting/building the plan and then build QueryPlanOptimizationSettings from interpreter.getContext() rather than the outer context.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is true that now we for subquery with IN or GLOBAL IN we can have a inner query which executes in distributed way, but outer query falls back to local execution. The cause is query context which is is to be propagated. Since the main goal of this PR is fallback to local execution instead of error, this will be addressed in the other PR (issue relevant here: #119466) .

optimization_settings.make_distributed_plan = false;
/// Include the fallback decision here before call to optimize
if (child_plan.isInitialized())
child_plan.applyDistributedPlanFallbackToLocal(optimization_settings);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This only records the child's fallback on the QueryPlanOptimizationSettings snapshot. For analyzer-built child plans the captured QueryNode / UnionNode contexts still keep make_distributed_plan = 1, because nothing here updates modified_context or the query tree the child plan already captured.

That recreates the same leak this PR fixes in InterpreterSelectQueryAnalyzer: if a Merge child falls back locally (for example through a nested View child) and a pushed-down filter contains IN (SELECT ...), child.plan.optimize() can still drive FutureSetFromSubquery::buildOrderedSetInplace through the distributed path on what is supposed to be a local plan. I think the fallback needs to be applied before extractQueryPlan() on the analyzer child interpreter, or this branch needs to flip the child context tree when applyDistributedPlanFallbackToLocal() returns true.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed here: #116487 (comment)

@clickhouse-gh

clickhouse-gh Bot commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

📊 Cloud Performance Report

✅ AI verdict: no_change — no significant changes across 39 queries analysed

This PR reworks the make_distributed_plan pathway so that a plan which cannot be distributed falls back to local execution instead of throwing, gated by the new default-off distributed_plan_fallback_to_local_execution setting. That entire code path is only reachable when make_distributed_plan (a private preview, disabled by default) is enabled, which standard ClickBench runs do not set, so the ordinary query-execution and optimization hot paths are unchanged. The four flagged queries (Q9, Q28, Q33, Q34) all show small positive deltas (+5% to +11%) that the deterministic gates already kept within the baseline variance band as not_sure; since the diff cannot plausibly touch what these queries execute, they are downgraded as run-to-run variance. No cross-query pattern and no real regression is attributable to this change.

clickbench

⚠️ 4 inconclusive

Flagged queries (4 of 43)
Query Verdict Baseline median (ms) PR median (ms) Change q-value Hint
⚠️ 9 not_sure 389 431 +10.8% <0.0001 This PR only adds distributed-plan fallback plumbing under make_distributed_plan (a private-preview setting off by default); ClickBench queries never enter that path, so +10.8% is run-to-run variance, not a PR effect.
⚠️ 28 not_sure 1052 1106 +5.1% <0.0001 The diff touches only the make_distributed_plan fallback decision, which is disabled by default and not exercised by standard ClickBench execution, so this +5.1% shift is noise rather than a PR-caused regression.
⚠️ 33 not_sure 1155 1254 +8.6% <0.0001 Q33's hot path is untouched: the PR refactors distributed-plan rejection into fallback-to-local logic gated by make_distributed_plan (off by default), so +8.6% is not attributable to this change.
⚠️ 34 not_sure 1142 1240 +8.6% <0.0001 Same as Q33: the changed code only runs under the default-off make_distributed_plan setting, so this +8.6% consistent-looking delta reflects instance variance, not the PR.

Change = percent below ×2; the ratio of medians (×N faster/slower) beyond, where percent understates the scale. q-value = BH-FDR adjusted p; smaller is stronger evidence. MIRAI flags a query when q < fdr_q (default 0.10) — the value the verdict is based on.

tpch_adapted_1_official

🟢 No significant changes

Debug info
  • StressHouse run: 5c62e405-47c7-423c-a413-befe1e8875e7
  • MIRAI run: 28e23f3e-f41f-4aad-80a5-e915884f52ab
  • PR check IDs:
    • clickbench_187118_1789228051
    • clickbench_187124_1789228051
    • clickbench_187131_1789228051
    • tpch_adapted_1_official_187141_1789228051
    • tpch_adapted_1_official_187154_1789228051
    • tpch_adapted_1_official_187189_1789228051

@antoniofilipovic
antoniofilipovic added this pull request to the merge queue Sep 12, 2026
Merged via the queue into master with commit a6fe14f Sep 12, 2026
175 checks passed
@antoniofilipovic
antoniofilipovic deleted the afilipovic-fallback-local-exec-distributed-plan-failure branch September 12, 2026 16:50
@robot-ch-test-poll3 robot-ch-test-poll3 added the pr-synced-to-cloud The PR is synced to the cloud repo label Sep 12, 2026
@clickgapai

Copy link
Copy Markdown
Contributor

@antoniofilipovic @groeneai @davenger — ClickGap found the following in this PR:

Close anything that's wrong or already addressed.

@clickhouse-gh clickhouse-gh Bot added comp-distributed-query-exchange Distributed Query Execution with Exchange operators: cloud-native query distribution using stream... and removed comp-query-optimizer Query plan optimization: physical plan steps, plan-level rewrites and optimizations (QueryPlan pa... labels Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp-distributed-query-exchange Distributed Query Execution with Exchange operators: cloud-native query distribution using stream... pr-improvement Pull request with some product improvements pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fall back to local execution when a plan step does not support distributed execution (make_distributed_plan)

7 participants