Repository navigation
Revert "Explain analyze" (#106586) - #110162
Conversation
This reverts the `EXPLAIN ANALYZE` feature added in #106586 (merge commit 918a0d3), a revert of that merge with `-m 1`. It removes the query-executor instrumentation (`StepWallClock`, `StepWallClockRegistry`, `AnalyzePlanStats`, per-step wall-clock and per-port data accounting on `IProcessor`, per-stage processor grouping on `SortingStep`/`AggregatingStep`/`JoinStep`), the `ANALYZE` keyword and its handling in `ParserExplainQuery`/`InterpreterExplainQuery`, `StreamLocalLimits::forQueryResult`, and the associated tests and documentation. There are no merged follow-up pull requests to revert. The only follow-up, #110077 ("Reject EXPLAIN ANALYZE for streaming (STREAM) queries"), is still open and not part of `master`. The single revert conflict, in `tests/queries/0_stateless/03269_explain_unique_ids.reference`, was resolved to keep the unrelated node-id renumbering introduced later by "Fix Not-ready Set exception by making in-place set build non-destructive" (5583c9a) while reverting only the `EXPLAIN ANALYZE` step-id change. Co-Authored-By: Claude Fable 5 <[email protected]>
|
Preview deployment for your docs. Learn more about Mintlify Previews.
|
|
Workflow [PR], commit [cdb1ed9] AI ReviewSummaryThis PR reverts Findings❌ Blockers
Final VerdictStatus: |
|
|
||
| /// Record new processors in pipeline | ||
| const IProcessor & parent = *cur_node.processor(); | ||
| for (const auto & new_proc : update.to_add) |
There was a problem hiding this comment.
This drops the only generic place that re-attaches runtime-created processors to a query-plan step. After this, any updatePipeline implementation that returns fresh processors without manually tagging them, such as AggregatingTransform, MergeSortingTransform, LazyReadReplacingFinalSource, LazyReadFromMergeTreeSource, or DelayedSource, will log them with empty step_uniq_id / plan_step_name. The updated 03269_explain_unique_ids.reference already shows ConvertingAggregatedToChunksTransform losing its Aggregating_4 association. That is a regression for system.processors_profile_log and any tooling that correlates processors back to plan steps. Please either keep the generic inheritance here or re-tag every runtime-added processor before addNode.
There was a problem hiding this comment.
This is intentional: the PR is a clean git revert -m 1 of #106586, and this attribution block was added by that same feature (commit 1f966c9e65c "Propagate parent processor step to the newly created processor", which lives on the explain-analyze branch, not on master before the merge). Reverting it restores the exact pre-#106586 behavior — on master before the merge, system.processors_profile_log already reported ConvertingAggregatedToChunksTransform (and other runtime-added processors) with an empty step_uniq_id, as the reverted 03269_explain_unique_ids.reference line confirms. The feature never shipped in a stable release, so this is not a regression relative to any released version.
Preserving just the runtime-processor step propagation as a standalone improvement would turn this into a partial revert (it also depends on getQueryPlanStepGroup / inheritQueryPlanStepFromParent, which this revert removes). Leaving that decision to @alexey-milovidov as the author — happy to split it into a small follow-up on master if we want to keep that system.processors_profile_log attribution.
…list The revert of #106586 removed the `ANALYZE`, `ESTIMATE`, and `TABLE OVERRIDE` bullets from the `EXPLAIN Types` overview list, but `ESTIMATE` and `TABLE OVERRIDE` are still advertised in the syntax block and still have their own `### EXPLAIN ESTIMATE` and `### EXPLAIN TABLE OVERRIDE` sections later in the same document. Re-add those two bullets (but not `ANALYZE`, which is removed by this revert) so the page is internally consistent again. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
| @@ -259,10 +257,6 @@ QueryPipelineBuilderPtr QueryPlan::buildQueryPipeline( | |||
| if (limit_max_threads && max_threads) | |||
There was a problem hiding this comment.
This removes the last generic backstop that tags processors returned by a step. Several existing steps still rely on it because they create processors without a collector or manual setQueryPlanStep, for example ReadFromRemote::initializePipeline and the exchange send steps. The updated 03213_distributed_analyzer.reference already shows the effect: EXPLAIN PIPELINE graph=1 loses the ReadFromRemote cluster entirely because every processor in that subgraph now has step == nullptr. Please keep the fallback here or teach those steps to tag/collect their processors explicitly.
| pretty_names[output->result_name] = PrettyColumnName(formatNodePretty(output, pretty_names, runtime_filter_names, subquery_set_names)); | ||
| } | ||
| else if (step_name == "Aggregating") | ||
| else if (step_name == "Aggregating" || step_name == "AggregatingProjection") |
There was a problem hiding this comment.
AggregatingProjectionStep is not derived from AggregatingStep, so this merged branch turns pretty-name formatting into UB for plans that contain an aggregate projection. When step_name == "AggregatingProjection", the static_cast<const AggregatingStep *>(step.get()) reads the wrong object layout, so default-pretty EXPLAIN can emit garbage or hit an exception. Please keep a separate AggregatingProjectionStep branch here, or restore a getParams accessor on that class and use the right cast.
| connect(*left_port, squashing->getInputs().front()); | ||
| left_port = &squashing->getOutputPort(); | ||
| add_to_left_pipe(std::move(squashing)); | ||
| left->pipe.processors->emplace_back(std::move(squashing)); |
There was a problem hiding this comment.
The old add_to_left_pipe helper appended new processors both to left->pipe.processors and to collected_processors. After inlining it, this left-side SimpleSquashingChunksTransform only goes into the pipe itself, so JoinStep::processors no longer sees it. Textual EXPLAIN PIPELINE will silently omit that squashing wave whenever min_block_size_rows or min_block_size_bytes is enabled, and with the generic tagging fallback above removed it also stays untagged for graph/profile output. This needs the same if (collected_processors) collected_processors->emplace_back(squashing); treatment as the other processors in this function.
Reintroduces the `EXPLAIN ANALYZE` feature (originally #106586) by reverting its revert #110162 (merge commit 178267d, reverted with `-m 1`). The feature was reverted only because of a `Logical error: 'clock'` abort in `EXPLAIN ANALYZE` over a streaming (`FROM ... STREAM`) read in debug and sanitizer builds. The following commit fixes that bug, so the feature can be reintroduced. This restores the query-executor instrumentation (`StepWallClock`, `StepWallClockRegistry`, `AnalyzePlanStats`, per-step wall-clock and per-port data accounting on `IProcessor`, per-stage processor grouping on `SortingStep`/`AggregatingStep`/`JoinStep`), the `ANALYZE` keyword and its handling in `ParserExplainQuery`/`InterpreterExplainQuery`, `StreamLocalLimits::forQueryResult`, and the associated tests and documentation. Related: #106586 Related: #110162 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Pulls in the merged fix #110162 (revert of EXPLAIN ANALYZE pipeline timing, #110162), which fixes the 'clock' logical error that failed the Stress test (amd_msan) on this PR: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=110127&sha=e774374cff8ac2e6fb0e606fe60ed73930998360&name_0=PR&name_1=Stress%20test%20%28amd_msan%29
Pull in the revert of `EXPLAIN ANALYZE` (#110162, merged after this branch's previous merge-base) which removes the `InterpreterExplainQuery` `'clock'` logical error at `InterpreterExplainQuery.cpp:1234`. That error was the cause of the unrelated `Stress test (arm_tsan)` AST-fuzzer failure on this PR (stack: executeASTFuzzerQueries -> InterpreterExplainQuery::executeImpl, zero HiveText/serialization frames). Also brings the branch up to date with the current master. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
… was reintroduced `EXPLAIN ANALYZE` was reverted from master in ClickHouse#110162 and reintroduced in ClickHouse#110164, so the merge brings back `InterpreterExplainQuery.cpp`, which builds its accounting group with `std::make_shared<ThreadGroup>(outer_thread_group)`. This branch makes the borrowing `ThreadGroup` constructor private so borrowed groups are created only through factories, so the merge does not compile: `calling a private constructor of class 'DB::ThreadGroup'`. Re-add the `createForExplainAnalyze` factory (matching `createForMaterializedView` and `createForFlushAsyncInsertQueue`) and use it at the call site. This is the same change as 9b8462b, which was dropped by the previous merge because master had `EXPLAIN ANALYZE` reverted at the time. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…nalyze Revert "Explain analyze" (ClickHouse#106586)
Reverts the
EXPLAIN ANALYZEfeature added in #106586.This is a
git revert -m 1of the merge commit918a0d32a0cab22b2eb17c5d151c1245650465ef. It removes the query-executor instrumentation (StepWallClock,StepWallClockRegistry,AnalyzePlanStats, per-step wall-clock and per-port data accounting onIProcessor, per-stage processor grouping onSortingStep/AggregatingStep/JoinStep), theANALYZEkeyword and its handling inParserExplainQuery/InterpreterExplainQuery,StreamLocalLimits::forQueryResult, and the associated tests and documentation.There are no merged follow-up pull requests to revert. The only follow-up, #110077 ("Reject EXPLAIN ANALYZE for streaming (STREAM) queries"), is still open and not part of
master; it depends on this feature and would need to be closed or reworked.The single revert conflict, in
tests/queries/0_stateless/03269_explain_unique_ids.reference, was resolved to keep the unrelated node-id renumbering later introduced by "Fix Not-ready Set exception by making in-place set build non-destructive" (5583c9a4176) while reverting only theEXPLAIN ANALYZEstep-id change.Related: #106586
Related: #110077
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Revert of #106586 (
EXPLAIN ANALYZE). The feature was added in the current development cycle and has not appeared in a stable release, so no user-facing changelog entry is required.Documentation entry for user-facing changes
Version info
26.7.1.826(included in26.7and later)