847850277 opened a new issue, #23410:
URL: https://github.com/apache/datafusion/issues/23410
### Describe the bug
DataFusion returns an incorrect result for a `NOT IN` subquery when the
subquery result contains `NULL` and another predicate is applied on the
left-side join key.
The following query returns `id = 2` in DataFusion, but it should return an
empty result according to SQL three-valued logic.
```sql
CREATE TABLE t(id INT, a INT);
INSERT INTO t VALUES (1, 1), (2, 2);
CREATE TABLE u(k INT);
INSERT INTO u VALUES (NULL);
SELECT id
FROM t
WHERE a != 1
AND a NOT IN (SELECT k FROM u);
```
Actual result in DataFusion:
```text
+----+
| id |
+----+
| 2 |
+----+
```
Expected result:
```text
+----+
| id |
+----+
+----+
```
### 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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]