Skip to content

Add test: UInt32 LowCardinality index-width branch of getDistinctIndexes (bloom filter over >65536-distinct LC column) untested - #107303

Merged
alexbakharew merged 5 commits into
ClickHouse:masterfrom
clickgapai:qa-bot/coverage-pr106410
Jul 30, 2026
Merged

alexbakharew merged 5 commits into
ClickHouse:masterfrom
clickgapai:qa-bot/coverage-pr106410

Conversation

@clickgapai

Copy link
Copy Markdown
Contributor

Found via ClickGap automated review. Please close or comment if this is incorrect or needs adjustment.

This is a test-only PR — no source code changes. Please review: test quality, whether the claimed coverage gaps are real, and whether test output makes sense.

Adds test coverage for 1 untested code path(s), found during automated review of PR #106410.
PR speeds up bloom_filter skip-index building for LowCardinality columns. It adds ColumnLowCardinality::getDistinctIndexes(offset, limit) (a switch over the LC index integer width UInt8/UInt16/UInt32/UInt64), BloomFilterHash::hashWithColumnDistinct / hashLowCardinalityColumnDistinct / `fin

1. UInt32 LowCardinality index-width branch of getDistinctIndexes (bloom filter over >65536-distinct LC column) untested
src/Columns/ColumnLowCardinality.cpp:653
Risk: MergeTreeIndexAggregatorBloomFilter::update -> BloomFilterHash::hashWithColumnDistinct -> hashLowCardinalityColumnDistinct -> ColumnLowCardinality::getDistinctIndexes switches on idx.getSizeOfIndexType(); the PR's own tests only ever reach the UInt8/UInt16 cases (<=1000 distinct). If the UInt32 branch were broken (wrong assert_cast, missing case), the granule's distinct dictionary positions would be read incorrectly, so the bloom filter would miss a value present in the granule and …
What's unique vs PR tests: The PR's 04100 test only inserts up to 1000 distinct LC values (UInt8/UInt16 index widths); this test forces a single block with 100000 distinct values so the LC index positions are UInt32, exercising the case sizeof(UInt32) branch of getDistinctIndexes that 04100 never reaches.
Tags: -- Tags: no-random-settings, long — no-random-settings: Random insert-block settings (max_insert_block_size, min_insert_block_size_rows, max_insert_threads) could split the 100000 rows into sub-65536-distinct blocks, taking the UInt16 branch instead and silently not exercising the UInt32 path under test.; long: 100000-row insert plus per-granule bloom-filter build is a heavier-than-typical fixture; tagged long to avoid tight-timeout flakiness.
Try it on ClickHouse Fiddle

Changelog category (leave one):

  • Not for changelog (changelog entry is not required)

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

Not applicable — test-only change.

Documentation entry for user-facing changes

  • Documentation is written (mandatory for new features)

@clickgapai

Copy link
Copy Markdown
Contributor Author

Pre-PR Validation Gate (per ClickGap pipeline):

a) Deterministic repro? ✅
Test exercises the previously-uncovered branch and passes (correct behaviour).

b) Root cause explained? ✅
src/Columns/ColumnLowCardinality.cpp:653 case sizeof(UInt32): populate(assert_cast<const ColumnUInt32 &>(indexes).getData()); break; -- correct but exercised by no test (only UInt8/UInt16 cases are reached by existing tests).

c) Fix matches root cause? ✅
N/A for coverage gap — this PR adds a regression test, not a fix. Asserts current correct behaviour at the cited line.

d) Test intent preserved? / New tests added? ✅
New regression test added: 04337_bloom_filter_low_cardinality_wide_dict.sql.

e) Both directions demonstrated? ✅
Test passes (MATCH) on master proving current correctness; would fail if the cited branch regressed. Single-direction is the correct shape for a coverage gap test.

f) Fix is general, not a narrow patch? ✅
Test asserts the invariant at the cited line — covers the branch, not a specific input shape.

@murphy-4o murphy-4o added the can be tested Allows running workflows for external contributors label Jun 12, 2026
@clickhouse-gh

clickhouse-gh Bot commented Jun 12, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [0874517]

Summary: ✅


AI Review

Summary

This test-only PR moves the wide-dictionary LowCardinality(String) bloom-filter coverage into 04100_bloom_filter_low_cardinality.sql and keeps the high-distinct insert that is meant to force the UInt32 index-width path. I did not find a correctness or contract issue in the current diff: the current Praktika reports are all green, and the published LLVM coverage artifact for this PR reports src/Columns/ColumnLowCardinality.cpp:658 (the case sizeof(UInt32) arm in getDistinctIndexes) as newly covered, which matches the branch the PR claims to add.

Final Verdict

✅ No findings in the current revision. I did not post any new inline review comments.

@clickhouse-gh clickhouse-gh Bot added the pr-not-for-changelog This PR should not be mentioned in the changelog label Jun 12, 2026
@alexbakharew alexbakharew self-assigned this Jun 18, 2026
alexbakharew pushed a commit that referenced this pull request Jun 18, 2026
@clickhouse-gh clickhouse-gh Bot added the manual approve Manual approve required to run CI label Jun 18, 2026
@CLAassistant

CLAassistant commented Jun 18, 2026 •

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ alexbakharew
❌ ClickGap AI Bot


ClickGap AI Bot seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

Comment thread ci/jobs/llvm_coverage_job.py Resolved
@alexbakharew

Copy link
Copy Markdown
Contributor

I will do some small experiment with LLVM coverage. I want to prove one method of stabilizing the numbers. I will remove all unrelated changes later today

@alexbakharew
alexbakharew force-pushed the qa-bot/coverage-pr106410 branch from 6e92881 to d0ce9a2 Compare June 19, 2026 11:54
@clickhouse-gh

clickhouse-gh Bot commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

LLVM Coverage Report

Metric Baseline Current Δ
Lines 85.20% 85.20% +0.00%
Functions 92.50% 92.50% +0.00%
Branches 77.40% 77.50% +0.10%

Changed lines: No C/C++ source files changed — skipping uncovered code analysis.

Newly covered by added/modified tests: 746 line(s), 57 function(s) across 156 file(s) · Details

Top files
  • src/Storages/ObjectStorage/DataLakes/Iceberg/RemoveOrphanFilesExecute.cpp: 140 line(s), 9 function(s)
  • src/Storages/ObjectStorage/DataLakes/Iceberg/SnapshotFilesTraversal.cpp: 74 line(s), 4 function(s)
  • src/Storages/ObjectStorage/DataLakes/Iceberg/ExecuteCommandArgs.h: 53 line(s), 13 function(s)
  • src/Storages/ObjectStorage/DataLakes/Iceberg/Utils.cpp: 34 line(s), 1 function(s)
  • src/Common/ZooKeeper/ZooKeeperImpl.cpp: 16 line(s)

Full report

@clickhouse-gh

clickhouse-gh Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Dear @alexbakharew, you haven't been active on this PR for 30 days. You will be unassigned. Will you continue working on it? If so, please feel free to reassign yourself.

@alexbakharew

Copy link
Copy Markdown
Contributor

@clickgapai move this test to existing file: tests/queries/0_stateless/04100_bloom_filter_low_cardinality.sql
Also merge latest master

@clickgapai

Copy link
Copy Markdown
Contributor Author

This finding's branch may be deleted or its PR closed, so I can't act on it directly. If you'd like the same change applied to a new PR, open it (or ask me to file a separate PR via a fresh comment on the original PR).

@alexbakharew
alexbakharew added this pull request to the merge queue Jul 30, 2026
Merged via the queue into ClickHouse:master with commit 1ae27a6 Jul 30, 2026
351 of 353 checks passed
@robot-clickhouse-ci-2 robot-clickhouse-ci-2 added the pr-synced-to-cloud The PR is synced to the cloud repo label Jul 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

can be tested Allows running workflows for external contributors manual approve Manual approve required to run CI 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.

5 participants