Skip to content

Apply -WithMemoryTracking containers to the rest of src/Processors/QueryPlan - #130369

Merged
nickitat merged 15 commits into
masterfrom
wmt_processors_query_plan_optimizations
Nov 19, 2026
Merged

nickitat merged 15 commits into
masterfrom
wmt_processors_query_plan_optimizations

Conversation

@nickitat

@nickitat nickitat commented Nov 9, 2026 •

Copy link
Copy Markdown
Member

Changelog category (leave one):

  • Not for changelog (changelog entry is not required)

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

Version info

  • Merged into: 26.11.1.2861-master (included in 26.11 and later)

@clickhouse-gh

clickhouse-gh Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [4577138]

Summary: ✅


AI Review

Summary

PR #130369, reviewed at 457713836ec23378b783d7d390bfc3b952c286c4, replaces remaining standard containers in QueryPlan with existing memory-tracked equivalents, adapts related top-K interfaces, and extends the container lint. The changes preserve container semantics and serialization while enforcing memory limits on additional allocations. No actionable findings remain. Prior discussions contain no inline threads. Available CI reports report 15,079 passed tests and zero failures; no local build or tests were run.

Final Verdict

✅ Approve

@clickhouse-gh clickhouse-gh Bot added pr-not-for-changelog This PR should not be mentioned in the changelog comp-query-optimizer Query plan optimization: physical plan steps, plan-level rewrites and optimizations (QueryPlan pa... labels Nov 9, 2026
@clickhouse-gh

clickhouse-gh Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Build profile diff (arm_release)

Comparing 457713836 with master 80806f2a4 (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

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

Job report

nickitat added a commit that referenced this pull request Nov 10, 2026
…y_plan

Master moved the `ActionsDAG` traversals to `ActionsDAGTraversal.h`; the conflicts
in `ActionsDAG.cpp`, `FilterStep.cpp`, `actionsDAGUtils.cpp` and `filterPushDown.cpp`
take master's code with the tracked containers it still declares. The other
conflicts are in `IQueryPlanStep.cpp` includes, `ReadFromMergeTree.h` and
`optimizeUseAggregateProjection.cpp`.

Also converted the containers master added in `RelationEstimateInfo.h`,
`JoinStepLogical.cpp`, `ReadFromMergeTree.cpp`, `Cascades/Properties.cpp` and
`lowerArrayJoinFunction.cpp`, and the `getCompilableDAG` declaration master added
to `JIT/CompileDAG.h`. The new `Cascades` window rule follows `Rule.h`, which is
converted in #130369.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01DFFRj3kqWUsA1C3A8DapeT
nickitat and others added 3 commits November 10, 2026 20:01
…y_plan_optimizations

Also used `VectorWithMemoryTracking` in the new `Cascades` rule
`WindowImplementation`, whose `applyImpl` overrides the one in `Rule.h`.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01DFFRj3kqWUsA1C3A8DapeT
#129617 is merged, so the whole directory now uses
the containers with memory tracking. Also convert the containers master added since then.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01DFFRj3kqWUsA1C3A8DapeT
@nickitat nickitat changed the title Apply -WithMemoryTracking containers to src/Processors/QueryPlan/Optimizations Apply -WithMemoryTracking containers to the rest of src/Processors/QueryPlan Nov 15, 2026
nickitat and others added 2 commits November 15, 2026 15:46
@nickitat
nickitat marked this pull request as ready for review November 15, 2026 19:16
@nickitat
nickitat requested a review from azat November 15, 2026 19:16
@azat azat self-assigned this Nov 16, 2026
clickhouse-gh[bot]
clickhouse-gh Bot previously approved these changes Nov 16, 2026

@clickhouse-gh clickhouse-gh Bot left a comment

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.

AI review approves this commit, see the AI Review comment.

nickitat and others added 5 commits November 17, 2026 11:16
Resolve conflicts: `Planner.cpp` code moved to `PlannerSteps.cpp` (reapply `VectorWithMemoryTracking` for the `TopKParams` directions); `[[nodiscard]]` on the `Cascades::Optimizer` rule getters. Convert the new std containers in `optimizeReadInOrder.cpp` and `applyParallelReplicas.cpp`.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01DFFRj3kqWUsA1C3A8DapeT
…zations' into wmt_processors_query_plan_optimizations
…y_plan_optimizations

# Conflicts:
#	src/Processors/QueryPlan/Optimizations/Cascades/Rules/AggregationImplementations.cpp
clickhouse-gh[bot]
clickhouse-gh Bot previously approved these changes Nov 17, 2026
clickhouse-gh[bot]
clickhouse-gh Bot previously approved these changes Nov 17, 2026
@nickitat
nickitat added this pull request to stack #132687 November 18, 2026 15:16
@nickitat
nickitat added this pull request to the merge queue Nov 18, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 18, 2026
nickitat and others added 2 commits November 18, 2026 18:26
…cessors/QueryPlan`

`hasUnboundedSource` and `findPKRangesForFinalAfterSkipIndex` came from master
and failed the std-container lint on the merge commit. `DenseBitsetRuntimeFilter::words`
is a plain vector on purpose (it must not be refused at the memory limit), so it is marked
with `STYLE_CHECK_ALLOW_STD_CONTAINERS` instead.

PR: #130369

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01DFFRj3kqWUsA1C3A8DapeT
@clickhouse-gh
clickhouse-gh Bot dismissed stale reviews from themself November 18, 2026 19:57

AI review of a later commit does not approve the PR, see the AI Review comment.

@nickitat
nickitat added this pull request to the merge queue Nov 19, 2026
Merged via the queue into master with commit b735d6e Nov 19, 2026
194 checks passed
@nickitat
nickitat deleted the wmt_processors_query_plan_optimizations branch November 19, 2026 17:01
@robot-clickhouse-ci-2 robot-clickhouse-ci-2 added the pr-synced-to-cloud The PR is synced to the cloud repo label Nov 19, 2026
nickitat added a commit that referenced this pull request Nov 19, 2026
`src/Processors/QueryPlan` is linted for std containers since #130369,
and `CapturedPlan::nodes` and `sub_plans` already use `VectorWithMemoryTracking` there.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01DFFRj3kqWUsA1C3A8DapeT
Manerone added a commit that referenced this pull request Nov 24, 2026
#130369 switched the containers of
`CapturedPlan` to `VectorWithMemoryTracking`. The conflict kept the
`CapturedPlan::collected` field and took master's
`VectorWithMemoryTracking<CapturedStep> nodes`.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp-query-optimizer Query plan optimization: physical plan steps, plan-level rewrites and optimizations (QueryPlan pa... pr-not-for-changelog This PR should not be mentioned in the changelog 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.

3 participants