You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "SubhamSinghal (via GitHub)" <gi...@apache.org> on 2026/04/11 08:05:59 UTC
[PR] EliminateOuterJoin with Like, IsTrue, IsFalse, IsNotUnknown [datafusion]
SubhamSinghal opened a new pull request, #21549:
URL: https://github.com/apache/datafusion/pull/21549
## Which issue does this PR close?
Related to: https://github.com/apache/datafusion/issues/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.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] EliminateOuterJoin with Like, IsTrue, IsFalse, IsNotUnknown [datafusion]
Posted by "SubhamSinghal (via GitHub)" <gi...@apache.org>.
SubhamSinghal commented on PR #21549:
URL: https://github.com/apache/datafusion/pull/21549#issuecomment-4231054746
> Could you also handle nullable columns on the pattern side and add a test for that shape?
Thanks @kumarUjjawal for pointing this out. Added fix and ut for the same.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] EliminateOuterJoin with Like, IsTrue, IsFalse, IsNotUnknown [datafusion]
Posted by "2010YOUY01 (via GitHub)" <gi...@apache.org>.
2010YOUY01 merged PR #21549:
URL: https://github.com/apache/datafusion/pull/21549
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] EliminateOuterJoin with Like, IsTrue, IsFalse, IsNotUnknown [datafusion]
Posted by "2010YOUY01 (via GitHub)" <gi...@apache.org>.
2010YOUY01 commented on code in PR #21549:
URL: https://github.com/apache/datafusion/pull/21549#discussion_r3068835060
##########
datafusion/sqllogictest/test_files/eliminate_outer_join.slt:
##########
@@ -198,6 +198,133 @@ select * from t1 left join t2 on t1.a = t2.x where t2.x in (1, 2) or t2.x is nul
3 30 c NULL NULL NULL
NULL 40 d NULL NULL NULL
+###
Review Comment:
It would be great to add a few more tests:
- FULL JOINs (covering FULL -> INNER / LEFT / RIGHT depending on which side is null-rejecting — not sure if all cases are implemented yet 🤔)
- Nested predicates with `AND` / `OR`
Some basic mixed-predicate cases would be good, as I assume they’re already extensively tested before.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] EliminateOuterJoin with Like, IsTrue, IsFalse, IsNotUnknown [datafusion]
Posted by "SubhamSinghal (via GitHub)" <gi...@apache.org>.
SubhamSinghal commented on PR #21549:
URL: https://github.com/apache/datafusion/pull/21549#issuecomment-4232054844
@neilconway will add new exprs in another PR
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] EliminateOuterJoin with Like, IsTrue, IsFalse, IsNotUnknown [datafusion]
Posted by "SubhamSinghal (via GitHub)" <gi...@apache.org>.
SubhamSinghal commented on PR #21549:
URL: https://github.com/apache/datafusion/pull/21549#issuecomment-4238494222
@2010YOUY01 created git issue for tracking generalized API task: https://github.com/apache/datafusion/issues/21597
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] EliminateOuterJoin with Like, IsTrue, IsFalse, IsNotUnknown [datafusion]
Posted by "neilconway (via GitHub)" <gi...@apache.org>.
neilconway commented on PR #21549:
URL: https://github.com/apache/datafusion/pull/21549#issuecomment-4231977854
What about `IS SIMILAR TO`?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] EliminateOuterJoin with Like, IsTrue, IsFalse, IsNotUnknown [datafusion]
Posted by "asolimando (via GitHub)" <gi...@apache.org>.
asolimando commented on code in PR #21549:
URL: https://github.com/apache/datafusion/pull/21549#discussion_r3069132135
##########
datafusion/sqllogictest/test_files/eliminate_outer_join.slt:
##########
@@ -198,6 +198,133 @@ select * from t1 left join t2 on t1.a = t2.x where t2.x in (1, 2) or t2.x is nul
3 30 c NULL NULL NULL
NULL 40 d NULL NULL NULL
+###
Review Comment:
Feel free to ping me if an extra set of eyes is needed to check similar generalized APIs, I agree they are very useful, and they are also battle tested
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org