yashmayya commented on code in PR #16038:
URL: https://github.com/apache/pinot/pull/16038#discussion_r2135395629


##########
pinot-query-runtime/src/main/java/org/apache/pinot/query/runtime/operator/HashJoinOperator.java:
##########
@@ -234,6 +289,11 @@ private List<Object[]> 
buildJoinedDataBlockAnti(MseBlock.Data leftBlock) {
     for (Object[] leftRow : leftRows) {
       Object key = _leftKeySelector.getKey(leftRow);
       // ANTI-JOIN only checks non-existence of the key
+      // For ANTI-JOIN, rows with null keys should be included (null != 
anything)
+      if (isNullKey(key)) {
+        rows.add(leftRow);
+        continue;
+      }

Review Comment:
   Hm, I'm not sure this is the right thing to do. Taking Postgres for instance 
(which is usually the reference we use in Pinot for SQL semantics):
   
   ```
   postgres=# CREATE TABLE t1 (i int);
   CREATE TABLE
   postgres=# CREATE TABLE t2 (i int);
   CREATE TABLE
   postgres=# INSERT INTO t1 VALUES (1), (2), (null);
   INSERT 0 3
   postgres=# INSERT INTO t2 VALUES (1), (2), (null);
   INSERT 0 3
   
   postgres=# SELECT * FROM t2 WHERE i NOT IN (SELECT i FROM t2);
    i
   ---
   (0 rows)
   
   ```
   
   It's the same behavior with both `NOT IN` and `NOT EXISTS` - `null` keyed 
rows from the left table are never selected regardless of whether or not a 
corresponding `null` keyed row exists in the right table.



-- 
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: commits-unsubscr...@pinot.apache.org

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


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

Reply via email to