You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "alamb (via GitHub)" <gi...@apache.org> on 2024/01/01 17:44:22 UTC

Re: [PR] Simplify `NULL [NOT] IN (..)` expressions [arrow-datafusion]

alamb commented on code in PR #8691:
URL: https://github.com/apache/arrow-datafusion/pull/8691#discussion_r1439064211


##########
datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs:
##########
@@ -481,6 +481,14 @@ impl<'a, S: SimplifyInfo> TreeNodeRewriter for Simplifier<'a, S> {
                 lit(negated)
             }
 
+            // null in (x, y, z) --> null

Review Comment:
   I double checked that this is consistent with posgres: 
   
   ```sql
   postgres=# select null IN (1,2);
    ?column?
   ----------
   
   (1 row)
   
   postgres=# select null IN (NULL);
    ?column?
   ----------
   
   (1 row)
   
   postgres=# select null NOT IN (1,2);
    ?column?
   ----------
   
   (1 row)
   
   postgres=# select null NOT IN (NULL,1,2);
    ?column?
   ----------
   
   (1 row)
   ```
   



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org