Skip to content

[branch-54] chore: Cleanup and refactor build_join in ScalarSubqueryToJoin (#…#22693

Merged
alamb merged 1 commit into
apache:branch-54from
LiaCastaneda:lia/backport-pr-22316
Jun 1, 2026
Merged

[branch-54] chore: Cleanup and refactor build_join in ScalarSubqueryToJoin (#…#22693
alamb merged 1 commit into
apache:branch-54from
LiaCastaneda:lia/backport-pr-22316

Conversation

@LiaCastaneda
Copy link
Copy Markdown
Contributor

@LiaCastaneda LiaCastaneda commented Jun 1, 2026

This is PR packports #22316 from @neilconway to branch-54

…pache#22316)

## Which issue does this PR close?

- N/A

## Rationale for this change

This PR cleans up and refactors `build_join`, which is used as part of
rewriting correlated subqueries.

## What changes are included in this PR?

* This routine only needs to handle correlated subqueries now, so
simplify the code and add an assert to that effect
* Clarify variable names
* Improve comments
* Hoist a few variables outside of loops, when possible
* Use `when`, `lit` and `not` helpers to build the `CASE` expression

## Are these changes tested?

Yes, covered by existing tests.

## Are there any user-facing changes?

No, no functional changes at all.
@alamb alamb merged commit d32964e into apache:branch-54 Jun 1, 2026
38 checks passed
@alamb
Copy link
Copy Markdown
Contributor

alamb commented Jun 1, 2026

🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

optimizer Optimizer rules

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants