alamb commented on issue #3159:
URL: 
https://github.com/apache/arrow-datafusion/issues/3159#issuecomment-1215753304

   Looks like there is sqlparser support: 
https://docs.rs/sqlparser/latest/sqlparser/ast/enum.Expr.html#variant.IsTrue
   
   Added in `0.18.0`:  
https://github.com/sqlparser-rs/sqlparser-rs/blob/main/CHANGELOG.md#0180-2022-06-06
   
   So this should be a fairly straightforward exercise -- note that `IS` and 
`=` are very subtlety differnt
   
   Since we already have similar semantics for `IS` with the `IS NOT DISTINCT 
FROM` longer form syntax, I think this could potentially simply have the the 
SQL planner plan 
   
   ```sql
   IS <expr>
   ``` 
   
   as
   
   ```sql
   is not distinct from <expr> as 'IS <expr.
   ```
   
   Here is what postgres does
   
   ```sql
   psql (14.4)
   Type "help" for help.
   
   alamb=# select null = null;
    ?column? 
   ----------
    
   (1 row)
   
   alamb=# select null IS null;
    ?column? 
   ----------
    t
   (1 row)
   
   alamb=# select null IS DISTINCT FROM null;
    ?column? 
   ----------
    f
   (1 row)
   
   alamb=# select null IS NOT DISTINCT FROM null;
    ?column? 
   ----------
    t
   (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: [email protected]

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

Reply via email to