alamb opened a new issue, #6179:
URL: https://github.com/apache/arrow-datafusion/issues/6179

   ### Is your feature request related to a problem or challenge?
   
   When simplifying expressions in general, care must be taken with nulls. For 
example it seems like this expression can be simplified to `false`:
   
   ```sql
   A AND !A
   ```
   
   however, if `A` is `null` then the expression actually evaluates to `null` 
and not `false` 
   
   The existing simplification code handles these cases by checking 
`is_nullable`:
   
   
https://github.com/apache/arrow-datafusion/blob/71efcf5ee8900a1efe12fb812e210e6941060733/datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs#L575-L582
   
   
   However, if we are using `A AND !A` as a filter, we can actually simplify 
the whole thing to `false` because for filtering:
   
   * `true` --> row is kept
   *`false` --> row is not kept
   * `null` --> row is not kept (same as false)
   
   
   ### Describe the solution you'd like
   
   I would like someone to figure out how to take advantage of the above 
observation to apply more simplification rules when simplifying predicates
   
   ### Describe alternatives you've considered
   
   _No response_
   
   ### Additional context
   
   _No response_


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to