-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Simplify comparisons and binary operations involving NULL #17088
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
Simplify comparisons and binary operations involving NULL #17088
Conversation
03173f0 to
ff9b921
Compare
302956d to
6d9d469
Compare
| 02)--TableScan: t projection=[x] | ||
| physical_plan | ||
| 01)CoalesceBatchesExec: target_batch_size=8192 | ||
| 02)--FilterExec: x@0 < 5 OR NULL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be followed-up: in a projection context this cannot be simplified, but in a filter context (on top-level of a filter), it can.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, the difference between Filters and Projections for null semantics has come up before. I think currently there is no way to differentiate
There is a ticket that tracks this idea too:
There were optimizations simplifying some arithmetic operations (`*`, `/`, `%` and some bitwise operations) when one operand is constant `NULL`. This can be extended to almost all other binary operators.
6d9d469 to
e3d60b3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
THanks @findepi -- this is a nice cleanup
| 02)--TableScan: t projection=[x] | ||
| physical_plan | ||
| 01)CoalesceBatchesExec: target_batch_size=8192 | ||
| 02)--FilterExec: x@0 < 5 OR NULL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, the difference between Filters and Projections for null semantics has come up before. I think currently there is no way to differentiate
There is a ticket that tracks this idea too:
datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs
Outdated
Show resolved
Hide resolved
|
The extended tests appear to have started failing on main after this PR was merged |
There were optimizations simplifying some arithmetic operations (
*,/,%and some bitwise operations) when one operand is constantNULL. This can be extended to almost all other binary operators.