Skip to content

Cherry pick #100401 to 26.2: Fix exception in join order optimizer when column names overlap - #105312

Merged
robot-ch-test-poll2 merged 11 commits into
backport/26.2/100401from
cherrypick/26.2/100401
May 19, 2026
Merged

robot-ch-test-poll2 merged 11 commits into
backport/26.2/100401from
cherrypick/26.2/100401

Conversation

@robot-ch-test-poll2

Copy link
Copy Markdown
Contributor

Original pull-request #100401

Do not merge this PR manually

This pull-request is a first step of an automated backporting.
It contains changes similar to calling git cherry-pick locally.
If you intend to continue backporting the changes, then resolve all conflicts if any.
Otherwise, if you do not want to backport them, then just close this pull-request.

The check results does not matter at this step - you can safely ignore them.

Troubleshooting

If the conflicts were resolved in a wrong way

If this cherry-pick PR is completely screwed by a wrong conflicts resolution, and you want to recreate it:

  • delete the pr-cherrypick label from the PR
  • delete this branch from the repository

You also need to check the Original pull-request for pr-backports-created label, and delete if it's presented there

The PR source

The PR is created in the CI job

alexey-milovidov and others added 11 commits March 23, 2026 00:57
The `JoinExpressionActions` constructor throws a LOGICAL_ERROR when left
and right join headers contain overlapping column names. This can happen
when scalar subquery results and join table aliases collide in complex
queries (e.g. both sides produce a column named `__table2`).

Skip the join order optimization in this case, falling back to the
unoptimized join which handles overlapping names correctly.

https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=100398&sha=d69b29735a13a4e8b1c0b95f263a4d962a8943da&name_0=PR&name_1=AST%20fuzzer%20%28amd_debug%2C%20targeted%2C%20old_compatibility%29

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
The test needs the exact fuzzed query with the original table schema
(including LowCardinality types) to reproduce the internal column name
collision. Removed serverError expectation since LOGICAL_ERROR cannot
be used in tests (it aborts in debug builds).

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
The join order optimizer is a new-analyzer feature, and the fuzzed query
causes stack overflow in `ApplyWithSubqueryVisitor` with the old analyzer.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
…ping-names

Fix exception in join order optimizer when column names overlap
@robot-ch-test-poll2 robot-ch-test-poll2 added pr-cherrypick Cherry-pick of merge-commit before backporting. Do not use manually - automated use only! do not test disable testing on pull request labels May 19, 2026
@robot-ch-test-poll2
robot-ch-test-poll2 merged commit b639f84 into backport/26.2/100401 May 19, 2026
@robot-ch-test-poll2
robot-ch-test-poll2 deleted the cherrypick/26.2/100401 branch May 19, 2026 13:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do not test disable testing on pull request pr-cherrypick Cherry-pick of merge-commit before backporting. Do not use manually - automated use only!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants