jayzhan211 commented on PR #25339:
URL: https://github.com/apache/datafusion/pull/25339#issuecomment-5738402844
Constant-projection rewrite only fires when the join filter is the bare `IN`
predicate. With a correlation, `1 = sq.id` is not an equi-key → `on[0]` is the
scope key, `1 = t4.id` lands in the join filter, and the exec applies value-key
NULL rules to `z`. **Same output on main, so not a regression**, but this PR
extends the positional `on[0]` convention to `LeftAnti` and the comment here
("null-aware hash joins accept only a single key") is now false.
Repro (returns `7, 10`; expected `7, NULL`):
```sql
CREATE TABLE t3(z INT) AS VALUES (10), (NULL), (7);
CREATE TABLE t4(id INT, z INT) AS VALUES (NULL, 10), (1, 99), (2, 7);
SELECT z FROM t3 WHERE 1 NOT IN (SELECT t4.id FROM t4 WHERE t4.z = t3.z)
ORDER BY z;
```
Fix: project the constant as a left column when `join_filter_opt` is `Some`
too, so the `IN` equality is always `on[0]`.
--
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]