Skip to content

Fix qualified column resolution for multiple JOINs with USING#95157

Merged
vdimir merged 3 commits intomasterfrom
vdimir/multiple_join_using_all_kinds
Jan 29, 2026
Merged

Fix qualified column resolution for multiple JOINs with USING#95157
vdimir merged 3 commits intomasterfrom
vdimir/multiple_join_using_all_kinds

Conversation

@vdimir
Copy link
Copy Markdown
Member

@vdimir vdimir commented Jan 26, 2026

Changelog category (leave one):

  • Bug Fix

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

  • Fixed type inference for qualified columns from source tables when multiple joins are used with USING clause. Previously, subsequent joins incorrectly updated types of underlying source columns to a common supertype even when the column was not involved in that join (e.g., in SELECT t2.a FROM t1 LEFT JOIN t2 USING (a) LEFT JOIN t3 USING (a), the t2.a column is only used by the first join, so its type should be the supertype of t1.a and t2.a, excluding t3.a). This could lead to logical errors or crashes when functions expected different column types than what actually appeared in the execution plan.

Ref #91738

@clickhouse-gh
Copy link
Copy Markdown
Contributor

clickhouse-gh bot commented Jan 26, 2026

Workflow [PR], commit [4047a5d]

Summary:

job_name test_name status info comment
Integration tests (amd_binary, 4/5) failure
test_peak_memory_usage/test.py::test_clickhouse_client_max_peak_memory_usage_distributed FAIL cidb, issue ISSUE EXISTS
Stress test (amd_tsan) failure
Logical error: Block structure mismatch in A stream: different number of columns: (STID: 0993-2da1) FAIL cidb, issue ISSUE EXISTS

@clickhouse-gh clickhouse-gh bot added the pr-not-for-changelog This PR should not be mentioned in the changelog label Jan 26, 2026
@yariks5s yariks5s self-assigned this Jan 26, 2026
Fix types after change in analyzer.
Added plus function to trigger logical error in case type is different
from resolved funciton argument.
@vdimir vdimir changed the title Use firstNonDefault for all join kinds Fix qualified column reslution for multiple JOINs with USING Jan 28, 2026
@vdimir vdimir changed the title Fix qualified column reslution for multiple JOINs with USING Fix qualified column resolution for multiple JOINs with USING Jan 29, 2026
@vdimir vdimir marked this pull request as ready for review January 29, 2026 10:49
@vdimir vdimir added this pull request to the merge queue Jan 29, 2026
Merged via the queue into master with commit 3c9da33 Jan 29, 2026
131 of 134 checks passed
@vdimir vdimir deleted the vdimir/multiple_join_using_all_kinds branch January 29, 2026 11:03
@robot-ch-test-poll4 robot-ch-test-poll4 added the pr-synced-to-cloud The PR is synced to the cloud repo label Jan 29, 2026
@vdimir vdimir added pr-bugfix Pull request with bugfix, not backported by default pr-must-backport Pull request should be backported intentionally. Use this label with great care! and removed pr-not-for-changelog This PR should not be mentioned in the changelog pr-must-backport Pull request should be backported intentionally. Use this label with great care! labels Feb 2, 2026
@robot-clickhouse robot-clickhouse added the pr-must-backport-synced The `*-must-backport` labels are synced into the cloud Sync PR label Feb 2, 2026
robot-clickhouse added a commit that referenced this pull request Feb 2, 2026
robot-clickhouse added a commit that referenced this pull request Feb 2, 2026
robot-clickhouse added a commit that referenced this pull request Feb 2, 2026
robot-clickhouse added a commit that referenced this pull request Feb 2, 2026
robot-clickhouse added a commit that referenced this pull request Feb 2, 2026
clickhouse-gh bot added a commit that referenced this pull request Feb 2, 2026
Backport #95157 to 26.1: Fix qualified column resolution for multiple JOINs with USING
@robot-ch-test-poll3 robot-ch-test-poll3 added the pr-backports-created Backport PRs are successfully created, it won't be processed by CI script anymore label Feb 2, 2026
clickhouse-gh bot added a commit that referenced this pull request Feb 2, 2026
Backport #95157 to 25.11: Fix qualified column resolution for multiple JOINs with USING
vdimir added a commit that referenced this pull request Feb 3, 2026
Backport #95157 to 25.12: Fix qualified column resolution for multiple JOINs with USING
clickhouse-gh bot added a commit that referenced this pull request Feb 3, 2026
Backport #95157 to 25.8: Fix qualified column resolution for multiple JOINs with USING
vdimir added a commit that referenced this pull request Feb 5, 2026
Backport #95157 to 25.3: Fix qualified column resolution for multiple JOINs with USING
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-backports-created Backport PRs are successfully created, it won't be processed by CI script anymore pr-bugfix Pull request with bugfix, not backported by default pr-must-backport Pull request should be backported intentionally. Use this label with great care! pr-must-backport-synced The `*-must-backport` labels are synced into the cloud Sync PR 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.

5 participants