Commit cda7b5c
EliminateOuterJoin with Like, IsTrue, IsFalse, IsNotUnknown (#21549)
## Which issue does this PR close?
Related to: #13232
## Rationale for this change
`EliminateOuterJoin` converts LEFT/RIGHT/FULL joins to INNER joins when
WHERE clause predicates are null-rejecting. The
`extract_non_nullable_columns` function recognizes specific expression
types but was missing several common ones: `LIKE`, `IS TRUE`, `IS
FALSE`, and `IS NOT UNKNOWN`.
All of these are null-rejecting:
- `NULL LIKE pattern` → NULL (filtered out)
- `NULL IS TRUE` → false (filtered out)
- `NULL IS FALSE` → false (filtered out)
- `NULL IS NOT UNKNOWN` → false (filtered out)
Note: `IS NOT TRUE`, `IS NOT FALSE`, and `IS UNKNOWN` are intentionally
**not** added — they return true for NULL input, so they are not
null-rejecting.
## What changes are included in this PR?
Added match arms in `extract_non_nullable_columns` for:
- `Expr::Like`
- `Expr::IsTrue` / `Expr::IsFalse` / `Expr::IsNotUnknown`
## Are these changes tested?
Yes — 7 new unit tests:
- 5 positive cases verifying outer → inner conversion (Like, IsTrue,
IsFalse, IsNotUnknown)
- 2 negative cases verifying outer join is preserved (IsNotTrue,
IsUnknown)
## Are there any user-facing changes?
No API changes.
---------
Co-authored-by: Subham Singhal <subhamsinghal@Subhams-MacBook-Air.local>1 parent 0143dfe commit cda7b5c
File tree
2 files changed
+758
-1
lines changed- datafusion
- optimizer/src
- sqllogictest/test_files
2 files changed
+758
-1
lines changed
0 commit comments