cloud-fan commented on a change in pull request #29484:
URL: https://github.com/apache/spark/pull/29484#discussion_r473787293



##########
File path: 
sql/core/src/main/scala/org/apache/spark/sql/execution/joins/HashJoin.scala
##########
@@ -442,7 +446,11 @@ trait HashJoin extends BaseJoinExec with CodegenSupport {
       case BuildRight => input ++ buildVars
     }
 
-    if (keyIsUnique) {
+    if (isEmptyHashedRelation) {
+      s"""
+         |// If HashedRelation is empty, hash inner join simply returns 
nothing.

Review comment:
       We can keep this change, as it at least avoids looking up an empty hash 
relation and is better than before. It's still useful with AQE is off.
   
   We just need to add a new rule, or extend rule `EliminateNullAwareAntiJoin` 
and rename it to `OptimizeJoinToEmptyRelation`.




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

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to