Skip to content

Correctly compute scopeLen for joins#3433

Merged
nicktobey merged 2 commits intomainfrom
nicktobey/scopelen
Feb 18, 2026
Merged

Correctly compute scopeLen for joins#3433
nicktobey merged 2 commits intomainfrom
nicktobey/scopelen

Conversation

@nicktobey
Copy link
Copy Markdown
Contributor

In a join node, the scopeLen variable is the total number of columns that represent values from outer scopes.

Previously, we set this value equal to the number of columns in the immediate parent scope. When there are multiple nested scopes, this value is incorrect.

This PR adds an example of when this matters: a non-lateral join in multiple nested scopes would return an incorrect number of columns. A projection above this join would then index into this returned row, resulting in an out-of-bounds error.

Copy link
Copy Markdown
Contributor

@fulghum fulghum left a comment

Choose a reason for hiding this comment

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

Looks good! Nice fix!

@nicktobey nicktobey merged commit a8094b2 into main Feb 18, 2026
9 checks passed
@nicktobey nicktobey deleted the nicktobey/scopelen branch February 18, 2026 22:57
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