2010YOUY01 opened a new issue, #11248:
URL: https://github.com/apache/datafusion/issues/11248

   ### Describe the bug
   
   ```shell
   DataFusion CLI v39.0.0
   > select 1 where null;
   Error during planning: Cannot create filter with non-boolean predicate 
'NULL' returning Null
   ```
   This query should return an empty set instead of planning error:
   NULL in SQL means the absence of a value, not a specific type.
   In the above query, it should interpret `NULL` as a missing boolean value.
   
   PostgreSQL reference:
   ```shell
   postgres=# select 1 where null;
    ?column? 
   ----------
   (0 rows)
   ```
   
   DataFusion also exeucte it correctly if `Null` value is within a column
   ```shell
   DataFusion CLI v39.0.0
   > create table t1(v1 boolean);
   0 row(s) fetched.
   Elapsed 0.076 seconds.
   
   > insert into t1 values (true),(false),(NULL);
   +-------+
   | count |
   +-------+
   | 3     |
   +-------+
   1 row(s) fetched.
   Elapsed 0.055 seconds.
   
   > select * from t1;
   +-------+
   | v1    |
   +-------+
   | true  |
   | false |
   |       |
   +-------+
   3 row(s) fetched.
   Elapsed 0.005 seconds.
   
   > select * from t1 where t1.v1;
   +------+
   | v1   |
   +------+
   | true |
   +------+
   1 row(s) fetched.
   Elapsed 0.010 seconds.
   ```
   
   Found by SQLancer's NoREC oracle 
https://github.com/apache/datafusion/issues/11030
   
   ### To Reproduce
   
   _No response_
   
   ### Expected behavior
   
   _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: github-unsubscr...@datafusion.apache.org.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org
For additional commands, e-mail: github-h...@datafusion.apache.org

Reply via email to