Skip to content

Look at every join node parent when computing outer scopes.#3384

Merged
nicktobey merged 2 commits intomainfrom
nicktobey/joinparents
Jan 21, 2026
Merged

Look at every join node parent when computing outer scopes.#3384
nicktobey merged 2 commits intomainfrom
nicktobey/joinparents

Conversation

@nicktobey
Copy link
Copy Markdown
Contributor

Previously, when building scopes for subqueries that appear inside joins, we would only track a single parent join node. If the subquery had multiple join parents, we would only be able to resolve references to the innermost subquery. This inhibits the optimizations we can perform.

This PR uses a custom tree walker to track a list of parent join nodes, and includes an example of a query that was not previously possible to optimize.

Copy link
Copy Markdown
Member

@zachmu zachmu left a comment

Choose a reason for hiding this comment

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

LGTM!

@nicktobey nicktobey merged commit 5eb2c94 into main Jan 21, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants