Skip to content

fix(optimizer): preserve right join filters [CODEX] - #7965

Closed
dev-willbird1936 wants to merge 2 commits into
tobymao:mainfrom
dev-willbird1936:fix/optimizer-right-join-filter-pushdown
Closed

fix(optimizer): preserve right join filters [CODEX]#7965
dev-willbird1936 wants to merge 2 commits into
tobymao:mainfrom
dev-willbird1936:fix/optimizer-right-join-filter-pushdown

Conversation

@dev-willbird1936

@dev-willbird1936 dev-willbird1936 commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

Direct or unisolated RIGHT JOIN predicates that reference only the preserved
right-side relation must not move from WHERE into ON. The rewrite changes
SQL semantics because rows that fail the predicate become unmatched preserved
rows and survive the join.

This patch keeps those filters after the join. It still pushes deterministic,
right-side-local predicates into the simple isolated source produced by table
isolation. It rejects unsafe derived sources, volatile expressions, and unsafe
later join shapes. The regression covers the affected boundary and nearby
safe behavior.

Issue #873 and PR #875 are related prior art, not duplicates. They addressed
left/non-preserved pushdown below a RIGHT JOIN and deliberately preserved
safe isolated right-side selection. Separate confirmed ON-origin
RIGHT/FULL variants and the FULL JOIN left-side WHERE variant are
outside this PR and are not claimed fixed.

This patch is based on
33de21fc21cdc05755a2de39318b292c10ccec0f and ends at
a303d120977930c25110c72b09454348fe793f2d.

Closes #7964.

OpenAI Codex was used to help analyze the bug, implement the fix, and validate
the tests. Commit authorship and subjects contain no AI credit.

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.

RIGHT JOIN predicate pushdown changes preserved-side WHERE semantics

2 participants