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


##########
pinot-query-runtime/src/main/java/org/apache/pinot/query/runtime/operator/HashJoinOperator.java:
##########
@@ -98,8 +104,36 @@ public String toExplainString() {
   protected void addRowsToRightTable(List<Object[]> rows) {
     assert _rightTable != null : "Right table should not be null when adding 
rows";
     for (Object[] row : rows) {
-      _rightTable.addRow(_rightKeySelector.getKey(row), row);
+      Object key = _rightKeySelector.getKey(row);
+      // Skip rows with null join keys - they should not participate in 
equi-joins per SQL standard
+      if (isNullKey(key)) {
+        // For RIGHT and FULL JOIN, we need to preserve null key rows for the 
final output
+        if (_nullKeyRightRows != null) {
+          _nullKeyRightRows.add(row);
+        }
+        continue;
+      }
+      _rightTable.addRow(key, row);
+    }
+  }
+
+  /**
+   * Check if a join key contains null values. In SQL standard, null keys 
should not match in equi-joins.
+   **/
+  private boolean isNullKey(Object key) {
+    if (key == null) {
+      return true;
     }
+    // For composite keys (Object[]), check if any component is null
+    if (key instanceof Object[]) {

Review Comment:
   I have addressed the issue and added the UT.



-- 
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