Skip to content

Preserve ALIAS column order for distributed reads#94644

Merged
vdimir merged 2 commits intoClickHouse:masterfrom
filimonov:distr_aliases
Jan 22, 2026
Merged

Preserve ALIAS column order for distributed reads#94644
vdimir merged 2 commits intoClickHouse:masterfrom
filimonov:distr_aliases

Conversation

@filimonov
Copy link
Contributor

@filimonov filimonov commented Jan 20, 2026

Changelog category (leave one):

  • Bug Fix (user-visible misbehavior in an official stable release)

Changelog entry (a [user-readable short description]

Fixes a bug where certain distributed queries with ORDER BY could return ALIAS columns with swapped values (i.e., column a showing column b’s data and vice versa).

Documentation entry for user-facing changes

Preserve insertion order for ALIAS expressions to keep distributed output column order stable.

Closes #86227

The problem was caused by iteration over the unordered_map added in https://github.com/ClickHouse/ClickHouse/pull/59595/changes#r2707576468

with later addition in
#78097

  • Documentation is written (mandatory for new features)

Store ALIAS expressions in insertion order to keep output column ordering
stable in distributed queries, and track alias names separately for
membership checks.
@vdimir vdimir self-assigned this Jan 20, 2026
@vdimir vdimir added the can be tested Allows running workflows for external contributors label Jan 20, 2026
@clickhouse-gh
Copy link
Contributor

clickhouse-gh bot commented Jan 20, 2026

Workflow [PR], commit [ea1def4]

Summary:

job_name test_name status info comment
BuzzHouse (arm_asan) failure
Logical error: Bad cast from type A to B (STID: 3336-4171) FAIL cidb IGNORED - #92359

@clickhouse-gh clickhouse-gh bot added the pr-bugfix Pull request with bugfix, not backported by default label Jan 20, 2026
@filimonov
Copy link
Contributor Author

filimonov commented Jan 20, 2026

the "Bugfix validation" is checking results[-1].results few lines after it was cleaned. Looks like CI/CD bug not mine :)

@maxknv will you fix it? It's here:

results[-1].results = []
# invert result status for bugfix validation
if is_bugfix_validation:
has_failure = False
for r in results[-1].results:

Maybe fixed here already: #94554

@vdimir vdimir added this pull request to the merge queue Jan 22, 2026
Merged via the queue into ClickHouse:master with commit 32e7ade Jan 22, 2026
130 of 132 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 Jan 22, 2026
zvonand pushed a commit to Altinity/ClickHouse that referenced this pull request Jan 27, 2026
Preserve ALIAS column order for distributed reads
zvonand added a commit to Altinity/ClickHouse that referenced this pull request Jan 28, 2026
25.8.15 Stable backport of ClickHouse#94644: Preserve ALIAS column order for distributed reads
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-bugfix Pull request with bugfix, not backported by default 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.

Alias, Order by and Distributed tables does not work properly together

4 participants