Skip to content

Disable distributed index analysis with projections (wrong results) - #115132

Merged
azat merged 1 commit into
ClickHouse:masterfrom
azat:disable-dia-with-projections
Aug 18, 2026
Merged

azat merged 1 commit into
ClickHouse:masterfrom
azat:disable-dia-with-projections

Conversation

@azat

@azat azat commented Aug 17, 2026 •

Copy link
Copy Markdown
Member

Changelog category (leave one):

  • Bug Fix (user-visible misbehavior in an official stable release)

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

Disable distributed index analysis with projections (wrong results)

Parts are identified by name, but projection parts share the projection's name across all parent parts, so analysis collapsed them into one entry and then filtered out valid parent parts, dropping rows. Skip distributed index analysis for projection parts (analyze locally); proper support needs parent part name + projection name on the wire.

Note, that the problem not only for applied projections:

if (candidate.sum_marks > parent_reading_marks)
{
stat.description = fmt::format(
"Projection {} is usable but requires reading {} marks, which is not better than the original table with {} marks",
candidate.projection->name,
candidate.sum_marks,
parent_reading_marks);
LOG_DEBUG(logger, "{}", stat.description);
continue;
}
else if (candidate.sum_marks == parent_reading_marks && parent_reading_marks > 0 && !force_optimize_projection && !sort_order_helps)
{
stat.description = fmt::format(
"Projection {} is usable but requires reading {} marks and does not help with sorting, which is not better than the original table",
candidate.projection->name,
candidate.sum_marks);
LOG_DEBUG(logger, "{}", stat.description);
continue;
}

But for any tables with usable projections, since we try to filter out parts based on the analysis from projections as well:

size_t filtered_parts = filterPartsByProjection(parent_reading_select_result, valid_parts);


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

Version info

  • Backported to: 26.7.4.58, 26.6.4.26, 26.5.7.64, 26.3.20.5

@clickhouse-gh

clickhouse-gh Bot commented Aug 17, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [aaffa68]

Summary: ✅


AI Review

Summary

This PR disables distributed index analysis when the analyzed parts are projection parts, which avoids collapsing multiple parent parts into one remote-analysis entry keyed only by the shared projection-part name. I traced the touched path through both normal projection selection and projection-filtering analysis, checked the current PR discussion and CI summary, and did not find a remaining correctness gap in the changed code.

Final Verdict

Status: ✅ Approve

LLVM Coverage Report

Metric Baseline Current Δ
Lines 86.90% 86.80% -0.10%
Functions 92.00% 92.00% +0.00%
Branches 79.30% 79.30% +0.00%

Changed lines: Changed C/C++ lines covered: 6/6 (100.00%) · Uncovered code

Full report · Diff report

@clickhouse-gh clickhouse-gh Bot added the pr-bugfix Pull request with bugfix, not backported by default label Aug 17, 2026
@KochetovNicolai KochetovNicolai self-assigned this Aug 17, 2026
@clickhouse-gh

clickhouse-gh Bot commented Aug 17, 2026 •

Copy link
Copy Markdown
Contributor

Build profile diff (arm_release)

Comparing aaffa6835 with master 79d8c6689 (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
Binary Master PR Δ
programs/clickhouse-stripped 702.06 MiB 699.04 MiB -3.03 MiB (-0.43%)

Only the stripped binary is compared: the official master build keeps debug symbols while PR builds strip them, so the other binaries differ by construction.

Compile time of recompiled translation units

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

Job report

@azat
azat force-pushed the disable-dia-with-projections branch from 258d718 to 8b7c707 Compare August 17, 2026 17:38
@azat
azat enabled auto-merge August 18, 2026 15:28
@azat
azat disabled auto-merge August 18, 2026 15:28
Parts are identified by name, but projection parts share the
projection's name across all parent parts, so analysis collapsed them
into one entry and then filtered out valid parent parts, dropping rows.
Skip distributed index analysis for projection parts (analyze locally);
proper support needs parent part name + projection name on the wire.
@azat
azat force-pushed the disable-dia-with-projections branch from 8b7c707 to aaffa68 Compare August 18, 2026 15:39
@azat
azat enabled auto-merge August 18, 2026 15:41
@azat
azat added this pull request to the merge queue Aug 18, 2026
Merged via the queue into ClickHouse:master with commit 03744a0 Aug 18, 2026
181 checks passed
@azat
azat deleted the disable-dia-with-projections branch August 18, 2026 22:51
@robot-ch-test-poll2 robot-ch-test-poll2 added the pr-backports-created Backport PRs are successfully created, it won't be processed by CI script anymore label Aug 18, 2026
@robot-ch-test-poll4 robot-ch-test-poll4 added the pr-must-backport-synced The `*-must-backport` labels are synced into the cloud Sync PR label Aug 18, 2026
@robot-ch-test-poll3 robot-ch-test-poll3 added the pr-synced-to-cloud The PR is synced to the cloud repo label Aug 19, 2026
clickhouse-gh Bot pushed a commit that referenced this pull request Aug 19, 2026
clickhouse-gh Bot added a commit that referenced this pull request Aug 19, 2026
Backport #115132 to 26.7: Disable distributed index analysis with projections (wrong results)
azat added a commit that referenced this pull request Aug 19, 2026
Backport #115132 to 26.3: Disable distributed index analysis with projections (wrong results)
azat added a commit that referenced this pull request Aug 19, 2026
Backport #115132 to 26.5: Disable distributed index analysis with projections (wrong results)
kewin-robetti pushed a commit to viasoftkorp/ClickHouse that referenced this pull request Aug 24, 2026
kewin-robetti pushed a commit to viasoftkorp/ClickHouse that referenced this pull request Aug 24, 2026
azat added a commit that referenced this pull request Aug 26, 2026
Backport #115132 to 26.6: Disable distributed index analysis with projections (wrong results)
kewin-robetti pushed a commit to viasoftkorp/ClickHouse that referenced this pull request Aug 28, 2026
bytehalo-infra added a commit to sentioxyz/ClickHouse that referenced this pull request Sep 25, 2026
CTE/AN/QP: distributed index analysis with projections -> wrong (feature now disabled).
Effect in the production build a394e92: its upstream test(s) 04891_distributed_index_analysis_projections fail on it and pass on official 26.8.8.8, run on isolated servers (evidence/fix_ci_20260925/upstream_repro/server_triage_PROD263_vs_UP2688.tsv).
Upstream patch unchanged, with its test(s): 04891_distributed_index_analysis_projections.

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

pr-backports-created Backport PRs are successfully created, it won't be processed by CI script anymore pr-bugfix Pull request with bugfix, not backported by default pr-must-backport-synced The `*-must-backport` labels are synced into the cloud Sync PR pr-synced-to-cloud The PR is synced to the cloud repo v26.2-must-backport v26.3-must-backport v26.4-must-backport v26.5-must-backport v26.6-must-backport v26.7-must-backport

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants