Skip to content

Antalya 25.8.14 backport of #87687 - Fix two-level aggregation when using Merge over Distributed#1328

Merged
Enmk merged 6 commits intoantalya-25.8from
backports/antalya-25.8/87687
Jan 26, 2026
Merged

Antalya 25.8.14 backport of #87687 - Fix two-level aggregation when using Merge over Distributed#1328
Enmk merged 6 commits intoantalya-25.8from
backports/antalya-25.8/87687

Conversation

@mkmkme
Copy link
Collaborator

@mkmkme mkmkme commented Jan 21, 2026

This PR also backports ClickHouse#88406 to fix the flaky test added in the original PR

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 to CHANGELOG.md):

Fixed two-level aggregation when using Merge over Distributed (ClickHouse#87687 by @c-end + ClickHouse#88406 by @azat).

CI/CD Options

Exclude tests:

  • Fast test
  • Integration Tests
  • Stateless tests
  • Stateful tests
  • Performance tests
  • All with ASAN
  • All with TSAN
  • All with MSAN
  • All with UBSAN
  • All with Coverage
  • All with Aarch64
  • All Regression
  • Disable CI Cache

Regression jobs to run:

  • Fast suites (mostly <1h)
  • Aggregate Functions (2h)
  • Alter (1.5h)
  • Benchmark (30m)
  • ClickHouse Keeper (1h)
  • Iceberg (2h)
  • LDAP (1h)
  • Parquet (1.5h)
  • RBAC (1.5h)
  • SSL Server (1h)
  • S3 (2h)
  • Tiered Storage (2h)

nickitat and others added 2 commits January 21, 2026 16:28
…merge-distributed

Fix two-level aggregation when using Merge over Distributed
…_merge_two_level_aggregation

tests: fix 03403_distributed_merge_two_level_aggregation flakiness
@github-actions
Copy link

github-actions bot commented Jan 21, 2026

Workflow [PR], commit [14076d5]

@mkmkme
Copy link
Collaborator Author

mkmkme commented Jan 22, 2026

The failed stateless tests are also related to enable_producing_buckets_out_of_order_in_aggregation. The old behaviour without that setting is not the same as with this setting enabled. To prove that, we can see the diff of the PR that introduced that setting: https://github.com/ClickHouse/ClickHouse/pull/80179/changes#diff-1806a5c1f13b491c615e887366acf1daac6d85b1528be423e3762705482c80fbR574

Otherwise the actual output of the test shows that the issue has been resolved, which is seen by the line GroupingAggregatedTransform 60 → 1 for ReadMergeTree which matches the upstream expected output and proves the pipeline is not being narrowed.

I'll update the .reference file to let the test pass, it's a matter of adding a new pass to it.

…uckets_out_of_order_in_aggregation

The test failed due to an extra step in actual pipeline output. It is
caused by a missing optimization
`enable_producing_buckets_out_of_order_in_aggregation` that was added to
upstream later and is not worth backporting at this point. The change
can be seen at [1].

[1]: https://github.com/ClickHouse/ClickHouse/pull/80179/changes#diff-1806a5c1f13b491c615e887366acf1daac6d85b1528be423e3762705482c80fbR574
Copy link
Collaborator

@arthurpassos arthurpassos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@CarlosFelipeOR
Copy link
Collaborator

CarlosFelipeOR commented Jan 26, 2026

QA verification

This change fixes a logical error in distributed two-level aggregation when using Merge over Distributed tables.
The fix and the new stateless test were reviewed and approved upstream in clickhouse/clickhouse.

For the Altinity backport:

  • All upstream CI checks passed, including the new stateless test 03403_distributed_merge_two_level_aggregation
  • Altinity regression tests passed

Considering that the stateless test was adapted for Antalya 25.8 (without enable_producing_buckets_out_of_order_in_aggregation),
I also executed the test 03403_distributed_merge_two_level_aggregation locally to confirm the expected behavior.

The test was executed:

  • on the PR build (antalya-25.8.14.20001)
  • and on the latest Antalya release (25.8.12.20747)

This confirmed the intended behavior:

  • before the fix, the pipeline was narrowed (GroupingAggregatedTransform 8 → 1)
  • after the fix, the pipeline is no longer narrowed (GroupingAggregatedTransform 60 → 1), matching the expected behavior.

The change is well-scoped, guarded by specific conditions, and covered by automation.

Marking this PR as verified.

@CarlosFelipeOR CarlosFelipeOR added the verified Verified by QA label Jan 26, 2026
@Enmk Enmk merged commit bd67f68 into antalya-25.8 Jan 26, 2026
900 of 907 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants