Skip to content

Add test for aggregation in order mismatch scenario - #105369

Merged
nihalzp merged 3 commits into
ClickHouse:masterfrom
nihalzp:test-aggregation-in-order
Jun 5, 2026
Merged

nihalzp merged 3 commits into
ClickHouse:masterfrom
nihalzp:test-aggregation-in-order

Conversation

@nihalzp

@nihalzp nihalzp commented May 19, 2026 •

Copy link
Copy Markdown
Member

Trying to see if the same parallel replica mismatch bug reproduces without sharded aggregation from #104233

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

...

Version info

  • Merged into: 26.6.1.402

@clickhouse-gh

clickhouse-gh Bot commented May 19, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [9af4ac3]

Summary: ✅


AI Review

Summary

This PR adds and re-enables stateless coverage for the interaction between optimize_aggregation_in_order and sharded aggregation. The re-enabled 03928 case matches the stated intent, but the new standalone 04257 regression test still does not exercise optimize_aggregation_in_order, so the PR's added coverage for the mismatch scenario is ineffective.

Findings
  • ⚠️ Major: [tests/queries/0_stateless/04257_aggregation_in_order_mismatch.sql:21,25] The test sets optimize_aggregation_in_order = 1 at session scope, but both compared subqueries override it with SETTINGS optimize_aggregation_in_order = 0. The assertion therefore compares the non-optimized GROUP BY path against itself and can pass even if the aggregation-in-order coordination mismatch regresses.
    Suggested fix: make one side run with optimize_aggregation_in_order = 1, or remove the per-subquery overrides and rely on the session-level SET.
Tests
  • ⚠️ Update the focused stateless assertion so it actually runs the optimize_aggregation_in_order = 1 path against the baseline.
Final Verdict

Status: ⚠️ Request changes

Minimum required action: fix 04257_aggregation_in_order_mismatch.sql so it exercises optimize_aggregation_in_order = 1 on the tested path, or remove it if the re-enabled 03928 coverage fully replaces it.

@clickhouse-gh clickhouse-gh Bot added the pr-not-for-changelog This PR should not be mentioned in the changelog label May 19, 2026
=
(SELECT sum(s), count() FROM
(SELECT a, sum(b) AS s FROM test GROUP BY a
SETTINGS optimize_aggregation_in_order = 0));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This assertion currently compares two subqueries that both set optimize_aggregation_in_order = 0, so it never exercises the optimize_aggregation_in_order = 1 path. That makes the preceding SET optimize_aggregation_in_order = 1 effectively dead for the compared queries, and this test can still pass even if the in-order aggregation path regresses.

Can we make one side run with optimize_aggregation_in_order = 1 (or remove both per-subquery overrides and rely on the outer SET) so the test actually validates the mismatch scenario?

@nihalzp
nihalzp enabled auto-merge June 4, 2026 19:01
@clickhouse-gh

clickhouse-gh Bot commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

LLVM Coverage Report

Metric Baseline Current Δ
Lines 84.40% 84.50% +0.10%
Functions 92.40% 92.40% +0.00%
Branches 77.00% 77.10% +0.10%

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

Newly covered by added/modified tests: 915 line(s), 52 function(s) across 134 file(s) · Details

Top files
  • src/Server/ACME/Client.cpp: 208 line(s), 9 function(s)
  • src/Server/ACME/API.cpp: 160 line(s), 15 function(s)
  • src/Common/OpenSSLHelpers.cpp: 52 line(s), 2 function(s)
  • src/Common/Crypto/KeyPair.cpp: 28 line(s), 5 function(s)
  • src/Backups/BackupEntriesCollector.cpp: 25 line(s), 2 function(s)

Full report

@nihalzp
nihalzp added this pull request to the merge queue Jun 5, 2026
Merged via the queue into ClickHouse:master with commit 1b10470 Jun 5, 2026
487 of 490 checks passed
@nihalzp
nihalzp deleted the test-aggregation-in-order branch June 5, 2026 03:30
@robot-ch-test-poll3 robot-ch-test-poll3 added the pr-synced-to-cloud The PR is synced to the cloud repo label Jun 5, 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