As pointed out by @xudong963 on #1376, there are several other rewrite rules we could add following the pattern in simplify: ``` A AND !(A) --> false (if A is not nullable) ``` Note that if `A` is null (or some expresson that could be null), then `A AND !(A)` is NULL Similarly, ``` A * 0 --> 0 (if A is not nullable) ``` The "is nullable" bit is somewhat tricky -- and to be honest I am not sure our current code handles all such cases correctly either.
Activity
Jefffrey commentedon Nov 14, 2022
Is already implemented:
https://github.com/apache/arrow-datafusion/blob/b58ec81ab06af7a267ee69b834715727dbef963d/datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs#L580-L591
Implemented by #4200