Skip to content

Add coverage tests for ROLLUP/CUBE/GROUPING SETS with external aggregation (PR #99228) - #99776

Merged
alexey-milovidov merged 2 commits into
ClickHouse:masterfrom
zlareb1:qa/pr99228-external-agg-rollup-grouping-sets
Mar 19, 2026
Merged

alexey-milovidov merged 2 commits into
ClickHouse:masterfrom
zlareb1:qa/pr99228-external-agg-rollup-grouping-sets

Conversation

@zlareb1

@zlareb1 zlareb1 commented Mar 17, 2026

Copy link
Copy Markdown
Member

PR #99228 replaces Block with Chunk throughout the aggregation pipeline (17 files). Two code paths that handle spill-to-disk had no correctness test coverage.

Coverage gap 1 — ROLLUP/CUBE with external aggregation (04046)

GroupByModifierTransform::merge() and writeToTemporaryFileImpl are exercised when ROLLUP or CUBE queries trigger external aggregation. The only existing test (04023_rollup_totals_memory_limit.sql) only checks that a memory-limit error is raised, not that results are correct.

04046_rollup_cube_with_external_group_by.sql runs ROLLUP and CUBE with max_bytes_before_external_group_by = 1 and compares the output against the same queries without spilling, for both group_by_use_nulls = 0 and = 1.

Coverage gap 2 — GROUPING SETS with external aggregation + two-level threshold (04047)

MergingAggregatedTransform::addChunk, mergeBlocks(BucketToChunks), and convertBlockToTwoLevel are exercised when GROUPING SETS queries trigger both external aggregation and two-level bucketing. No existing test covered this combination.

04047_grouping_sets_with_external_group_by.sql runs multi-set and single-set GROUPING SETS with max_bytes_before_external_group_by = 1 and group_by_two_level_threshold = 1, comparing against the same queries without those settings.

Both tests pass on current master, confirming the refactoring preserves correctness on these paths.

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):

...

Documentation entry for user-facing changes

  • Documentation is written (mandatory for new features)

…ation (PR ClickHouse#99228)

PR ClickHouse#99228 replaces `Block` with `Chunk` throughout the aggregation pipeline
(17 files). Two correctness paths had no test coverage:

1. `04046`: ROLLUP and CUBE with external aggregation (`max_bytes_before_external_group_by = 1`)
   – exercises `writeToTemporaryFileImpl` and `GroupByModifierTransform::merge()`.
   Verifies results match for ROLLUP/CUBE with and without `group_by_use_nulls`.

2. `04047`: GROUPING SETS with external aggregation + `group_by_two_level_threshold = 1`
   – exercises `MergingAggregatedTransform::addChunk`, `mergeBlocks(BucketToChunks)`,
   and `convertBlockToTwoLevel`. Includes a single-set path to cover the reordering branch.

Both tests pass, confirming the refactoring preserves correctness on these paths.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
@clickhouse-gh

clickhouse-gh Bot commented Mar 17, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [5bbebd4]

Summary: ✅

@clickhouse-gh clickhouse-gh Bot added the pr-not-for-changelog This PR should not be mentioned in the changelog label Mar 17, 2026
@zlareb1
zlareb1 marked this pull request as ready for review March 18, 2026 11:41
@zlareb1
zlareb1 requested a review from KochetovNicolai March 18, 2026 11:42
@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Mar 19, 2026
Merged via the queue into ClickHouse:master with commit 9a26589 Mar 19, 2026
159 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 Mar 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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