Skip to content

Do not reuse a server constant built in another scope. - #2471

Merged
zvonand merged 1 commit into
antalya-26.6from
bugfix/antalya-26.6/fix-union-hostname-server-constant
Oct 8, 2026
Merged

zvonand merged 1 commit into
antalya-26.6from
bugfix/antalya-26.6/fix-union-hostname-server-constant

Conversation

@ianton-ru

Copy link
Copy Markdown

hostName captured Context::isDistributed from the first UNION branch and was then folded on a cluster branch, so the GROUP BY headers no longer matched.

Solved #1181

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

Fix UNION of a local query and cluster() (or another cluster function) throwing NUMBER_OF_COLUMNS_DOESNT_MATCH or THERE_IS_NO_COLUMN on GROUP BY hostName. A server constant built on the local branch was reused for the cluster branch and folded to the initiator value. Each scope now builds its own value, so shards report their own hostName, serverUUID, tcpPort, and the other server constants.

Documentation entry for user-facing changes

...

CI/CD Options

Exclude tests:

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

Regression jobs to run:

  • Fast suites (mostly <1h)
  • Aggregate Functions (2h)
  • Alter (1.5h)
  • Benchmark (30m)
  • CAS (content-addressed storage; Antalya only)
  • ClickHouse Keeper (1h)
  • Iceberg (2h)
  • LDAP (1h)
  • OAuth (5m)
  • Parquet (1.5h)
  • RBAC (1.5h)
  • SSL Server (1h)
  • S3 (2h)
  • S3 Export (2h)
  • Swarms (30m)
  • Tiered Storage (2h)

`hostName` captured `Context::isDistributed` from the first `UNION` branch and was then folded on a cluster branch, so the `GROUP BY` headers no longer matched.

Co-authored-by: Cursor <[email protected]>
@github-actions

github-actions Bot commented Oct 2, 2026

Copy link
Copy Markdown

Workflow [PR], commit [60d1ce0]

@ilejn ilejn left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

LGTM

@zvonand

zvonand commented Oct 8, 2026

Copy link
Copy Markdown
Member

@blau-ai

@blau-ai

blau-ai commented Oct 8, 2026

Copy link
Copy Markdown
Collaborator

CI triage for #2471 @ 60d1ce0

Verdict: 3 red checks, 0 caused by this PR. 2 are base-image CVE scans, 1 is an infra/flaky UBSan crash in the binary self-extractor that happened before any test ran. Everything that actually exercises the code change is green (Fast test, all Stateless suites, 7/8 Integration shards, Stress, AST fuzzer, BuzzHouse, Unit tests, Regression).


1. Integration tests (amd_asan_ubsan, db disk, old analyzer, 5/8) — not PR-related (infra/flaky)

The job never got to run a single test. It died at the very first step, clickhouse --version, while the self-extracting binary decompresses itself:

Decompressing the binary
/ClickHouse/utils/self-extracting-executable/decompressor.cpp:209:60: runtime error:
  pointer index expression with base 0x7bba8a284000 overflowed to 0xd3620d1d244f8b11
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior .../decompressor.cpp:209:60
ERROR: Job killed, exit code [1]

Evidence it isn't this PR:

  • The crash is in utils/self-extracting-executable/decompressor.cpp:209 (*reinterpret_cast<FileData*>(input + check_pointer) — pointer arithmetic in the UBSan-instrumented decompressor stub). This PR only touches src/Analyzer/Resolve/resolveFunction.cpp + a stateless test; it has nothing to do with the decompressor.
  • It happened before any integration test executed, so no test actually failed (TRACEBACKS=[], no test_* results).
  • The other 7 of 8 integration shards all passed with 0 failures using the same binary.

This is a known sporadic UBSan false-positive in the self-extracting executable on the asan/ubsan build. Next step: just re-run the "Integration tests (amd_asan_ubsan, db disk, old analyzer, 5/8)" job — no code change needed.

2. GrypeScanKeeper / Grype Scan — not PR-related (base-image CVEs)

altinityinfra/clickhouse-keeper:2471-26.6.4.20001.altinityantalya — "Grype Scan Completed with 4 high/critical vulnerabilities". This scans the Docker image's OS/library packages for CVEs; it is independent of a C++ analyzer source change. Addressed by base-image updates, not by this PR.

3. GrypeScanServer (-alpine) / Grype Scan — not PR-related (base-image CVEs)

altinityinfra/clickhouse-server:...-alpine — "1 high/critical vulnerability" (Alpine base image). Note the non-alpine server image's Grype scan passed with 0. Same category as #2.


Health check

The change itself looks healthy. It's a tightly-scoped analyzer fix: in resolveFunction.cpp it adds !function->isServerConstant() to the condition that reuses a cached non-deterministic function instance across scopes, so a server constant (hostName, serverUUID, tcpPort, …) built and folded on a local UNION branch is no longer reused on a later cluster() branch (fixing the NUMBER_OF_COLUMNS_DOESNT_MATCH / THERE_IS_NO_COLUMN on GROUP BY hostName). It ships a focused regression test (05294_union_hostname_with_cluster_function). All 5 builds, the full Stateless matrix, 7/8 Integration shards, Stress, AST/BuzzHouse fuzzers, Unit tests and the Regression suites are green. Once the 5/8 shard is re-run (and given the Grype CVEs are a pre-existing base-image concern, not something this code change can affect), this PR is in good shape.

Posted by @blau-ai — automated CI triage. I can't build/run ClickHouse in this container, so verdicts are evidence-based from the praktika S3 reports and job logs.

@zvonand
zvonand merged commit f61f42a into antalya-26.6 Oct 8, 2026
309 of 316 checks passed
@ianton-ru ianton-ru added the port-antalya PRs to be ported to all new Antalya releases label Oct 8, 2026
@ianton-ru

Copy link
Copy Markdown
Author

PR in upstream: ClickHouse#123523

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.

5 participants