-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace Filter: Boolean(false)
with EmptyRelation
#3864
Comments
We can have two general rules:
|
@andygrove Looks like there is already a rule |
Perhaps the changes in #3841 from @Dandandan made it possible to simplify the filter Perhaps we could solve this issue by adding another run of |
@andygrove can you share a reproducer? We can then add it to the regression tests to make sure the empty filter is indeed eliminated and doesn't come back in |
Datafusion only can propagate In other words, we currently don't have really We can reproduce it. After 3 optimizations, the plan still can continue to be eliminated. CREATE TABLE IF NOT EXISTS t1 AS VALUES(1,'HELLO'),(12,'DATAFUSION');
CREATE TABLE IF NOT EXISTS t2 AS VALUES(1,'HELLO'),(12,'DATAFUSION');
CREATE TABLE IF NOT EXISTS t3 AS VALUES(1,'HELLO'),(12,'DATAFUSION');
explain verbose select column1 from t1 join ( select column1 from t2 join (select column1 from t3 where false ) as ta2 on t2.column1 = ta2.column1 ) as ta1 on t1.column1 = ta1.column1; |
FWIW, This is no longer an issue for me in Dask SQL. I am not sure what fixed it but maybe the multiple optimizer passes. |
Is your feature request related to a problem or challenge? Please describe what you are trying to do.
I have a query that looks like this after optimization:
Describe the solution you'd like
Remove everything under the
Filter
that is always false and replace withEmptyRelation
so that we avoid executing the join and aggregate.Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
Additional context
Add any other context or screenshots about the feature request here.
The text was updated successfully, but these errors were encountered: