Ben-Zvi commented on a change in pull request #1598: DRILL-6880: For Hash-Join 
hash-table build - treat null keys as an equal match 
URL: https://github.com/apache/drill/pull/1598#discussion_r245776838
 
 

 ##########
 File path: 
exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/common/HashTableTemplate.java
 ##########
 @@ -224,6 +224,13 @@ private boolean isKeyMatch(int incomingRowIdx,
       if (isProbe) {
         match = isKeyMatchInternalProbe(incomingRowIdx, currentIdxWithinBatch);
       } else {
+        // in case (of a hash-join only) where both the new incoming key and 
the current are null, treat them as
+        // a match; i.e. the new would be added into the helper (but not the 
Hash-Table !), though it would never
+        // be used (not putting it into the helper would take a bigger code 
change, and some performance cost, hence
+        // not worth it).  In the past such a new null key was added into the 
Hash-Table (i.e., no match), which
+        // created long costly chains - SEE DRILL-6880)
+        if ( areBothKeysNull(incomingRowIdx, currentIdxWithinBatch) ) { return 
true; }
 
 Review comment:
   The code on old line 230 is in a way "not clean", as it violates the 
method's name/signature (which implies just a functional comparison of two 
keys). That code advances to the next key in the hash-table chain in case of a 
no-match. The "clean way" would be to make this code a separate 
"advanceToNextIdx" method, which actually fits well in the for() loop where 
_isKeyMatch()_ is used. 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to