From e6bc050a497c530a9952f0faf51da8cdfa21f7cb Mon Sep 17 00:00:00 2001 From: Liang-Chi Hsieh Date: Mon, 20 May 2024 10:47:54 -0700 Subject: [PATCH] HashJoin LeftAnti Join should handle nulls correctly --- datafusion/sqllogictest/test_files/join.slt | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/datafusion/sqllogictest/test_files/join.slt b/datafusion/sqllogictest/test_files/join.slt index 6732d3e9108b1..353d75fd0f835 100644 --- a/datafusion/sqllogictest/test_files/join.slt +++ b/datafusion/sqllogictest/test_files/join.slt @@ -793,3 +793,19 @@ DROP TABLE companies statement ok DROP TABLE leads + + +# LeftAnti Join with null +statement ok +CREATE TABLE IF NOT EXISTS test_table(c1 INT, c2 INT) AS VALUES +(1, 1), +(2, 2), +(3, 3), +(4, null), +(null, 0); + +query II +SELECT * FROM test_table t1 WHERE (c1 NOT IN (SELECT c2 FROM test_table)) = true +---- +4 NULL +NULL 0