Skip to content

Add test: Batched no-key uniqCombined over FixedString columns (ColumnFixedString branch) is untested - #110327

Merged
CurtizJ merged 2 commits into
ClickHouse:masterfrom
clickgapai:qa-bot/coverage-pr109794
Jul 19, 2026
Merged

CurtizJ merged 2 commits into
ClickHouse:masterfrom
clickgapai:qa-bot/coverage-pr109794

Conversation

@clickgapai

@clickgapai clickgapai commented Jul 14, 2026 •

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 #109794.
PR #109794 optimizes uniqCombined/uniqCombined64 for aggregation WITHOUT a key. It (1) switches the String specialization type parameter from String to std::string_view, (2) overrides addBatchSinglePlace, addBatchSinglePlaceNotNull and addManyDefaults in AggregateFunctionUniqCombined

1. Batched no-key uniqCombined over FixedString columns (ColumnFixedString branch) is untested
src/AggregateFunctions/AggregateFunctionUniqCombined.h:237, src/AggregateFunctions/AggregateFunctionUniqCombined.h:238
Risk: addBatchImpl (AggregateFunctionUniqCombined.h:231) first tries typeid_cast<const ColumnString *>; when the column is a FixedString this fails and execution enters the else branch at 237-238 that assert_cast<const ColumnFixedString &> and hashes getDataAt(row). RISK: if the dispatch or the cast were wrong, FixedString aggregation without a key would throw a LOGICAL_ERROR exception or hash the wrong bytes -> wrong distinct counts.
What's unique vs PR tests: The PR's 04511 test aggregates only variable String columns (the typeid_cast branch); the FixedString sibling branch at 237-238 is never exercised.

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)

Version info

  • Merged into: 26.7.1.1185 (included in 26.7 and later)

@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? ✅
AggregateFunctionUniqCombined.h:237-238 — the ColumnFixedString branch of the batched no-key path, reached only for FixedString columns, uncovered by any test.

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: 04539_uniq_combined_fixed_string_no_key.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.

@alexey-milovidov alexey-milovidov added the can be tested Allows running workflows for external contributors label Jul 14, 2026
@clickhouse-gh

clickhouse-gh Bot commented Jul 14, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [6b799d0]

Summary: ✅


AI Review

Summary

This PR adds a focused stateless regression test for the FixedString no-key batched path in uniqCombined / uniqCombined64. The current SQL now covers both ordinary padded FixedString values and an embedded-\0 case that would fail if the ColumnFixedString branch hashed values as NUL-terminated strings or ignored bytes after the first zero, which matches the risk in src/AggregateFunctions/AggregateFunctionUniqCombined.h:231-238. I did not find any remaining correctness or test-quality issues in the current diff.

Final Verdict
  • Status: ✅ Approve

@clickhouse-gh clickhouse-gh Bot added the pr-not-for-changelog This PR should not be mentioned in the changelog label Jul 14, 2026
Existing rows only differed before the first \0 pad byte, so a
NUL-terminated hash regression would pass. New t_uniq_fs_nul rows
share prefix 'p'\0 and diverge after the NUL, cross-checked vs uniqExact.

Requested by @clickhouse-gh[bot] in ClickHouse#110327 (comment)
@CurtizJ CurtizJ self-assigned this Jul 19, 2026
@CurtizJ
CurtizJ added this pull request to the merge queue Jul 19, 2026
Merged via the queue into ClickHouse:master with commit 83a7f24 Jul 19, 2026
177 checks passed
@robot-ch-test-poll4 robot-ch-test-poll4 added the pr-synced-to-cloud The PR is synced to the cloud repo label Jul 19, 2026
zeekay pushed a commit to hanzoai/datastore that referenced this pull request Sep 11, 2026
Existing rows only differed before the first \0 pad byte, so a
NUL-terminated hash regression would pass. New t_uniq_fs_nul rows
share prefix 'p'\0 and diverge after the NUL, cross-checked vs uniqExact.

Requested by @clickhouse-gh[bot] in ClickHouse#110327 (comment)
zeekay pushed a commit to hanzoai/datastore that referenced this pull request Sep 11, 2026
…pr109794

Add test: Batched no-key `uniqCombined` over FixedString columns (ColumnFixedString branch) is untested
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 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.

4 participants