-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Expr simplifier doesn't simplify exprs that are same if you swap lhs with rhs regardless of cycles #14943
Comments
I think this would be a nice improvement There are code and existing tests that can simplify this type of expression. See tests here
Maybe we need to improve the logic somehow This would be a good thing for someone to look into |
@alamb something to note, even after manually applying the optimizer again it doesn't simply |
We simplify A = B and B = A in @ion-elgreco You might want to add |
@jayzhan211 has a PR to fix this here: |
I wonder if this is another example of code that would be beneficial to pull into simplify_expressions 🤔 |
If the fix gets included in DF46, then we can give it a spin in delta-rs to see if it fully resolves the issue |
I think it will not be present in DataFusion 46 (we have the RC out for voting now) |
Describe the bug
I was doing some improvements to merge in delta-rs to add an expr simplifier on our early pruning filter. While doing this I noticed that these type of expressions:
s.foo = 'a' and 'a' = s.foo
are not getting simplified intos.foo='a'
directly but rather ins.foo='a' and s.foo='a'
even when you set max cycles to ludicrous number of 100.If the lhs and rhs can be swapped and then it's equal to an existing expression, it should be removed in one cicle.
See one of our logs after using the simplifier:
Before simplifying
After simplifying once with max cycles 100
To Reproduce
This is the starting expression.
Expected behavior
Simplify further
Additional context
No response
The text was updated successfully, but these errors were encountered: