Skip to content

fix join bug - #7703

Merged
mccanne merged 2 commits into
mainfrom
fix-join-bug
Nov 23, 2026
Merged

mccanne merged 2 commits into
mainfrom
fix-join-bug

Conversation

@mccanne

@mccanne mccanne commented Nov 22, 2026

Copy link
Copy Markdown
Collaborator

Fix filters after outer joins being pushed into the side the join preserves (or lifted into the join condition), which turned filtered-out values into unmatched values and returned extra rows, e.g., LEFT JOIN … WHERE p.color='red' returned every left row. Inner joins are unchanged. Adds compiler/ztests/join-filter-outer.yaml.

Fix filters after outer joins being pushed into the side the join
preserves (or lifted into the join condition), which turned filtered-out
values into unmatched values and returned extra rows, e.g.,
LEFT JOIN … WHERE p.color='red' returned every left row.
Inner joins are unchanged. Adds compiler/ztests/join-filter-outer.yaml.
@mccanne

mccanne commented Nov 23, 2026

Copy link
Copy Markdown
Collaborator Author

A follow-up worth considering: this fix makes some left-join queries slower than before. LEFT JOIN p … WHERE p.color='red' now scans all of p and filters after the join. The usual optimization is to notice that p.color='red' can never be true for an unmatched row, turn the left join into an inner join, and then push the filter down. That would recover the old speed for this common pattern while keeping the right answer. It could be its own PR, perhaps when noneish-dot-missing lands.

@mccanne
mccanne merged commit e7e8227 into main Nov 23, 2026
2 checks passed
@mccanne
mccanne deleted the fix-join-bug branch November 23, 2026 12:07
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