leanken commented on a change in pull request #29104:
URL: https://github.com/apache/spark/pull/29104#discussion_r457464340



##########
File path: 
sql/core/src/main/scala/org/apache/spark/sql/execution/joins/BroadcastHashJoinExec.scala
##########
@@ -64,10 +65,32 @@ case class BroadcastHashJoinExec(
     val numOutputRows = longMetric("numOutputRows")
 
     val broadcastRelation = buildPlan.executeBroadcast[HashedRelation]()
-    streamedPlan.execute().mapPartitions { streamedIter =>
-      val hashed = broadcastRelation.value.asReadOnlyCopy()
-      
TaskContext.get().taskMetrics().incPeakExecutionMemory(hashed.estimatedSize)
-      join(streamedIter, hashed, numOutputRows)
+    if (isNullAwareAntiJoin) {
+      streamedPlan.execute().mapPartitionsInternal { streamedIter =>
+        if (broadcastRelation.value.inputEmpty) {
+          streamedIter
+        } else if (broadcastRelation.value.anyNullKeyExists) {

Review comment:
       > Interesting. Then I don't think we need to broadcast at all if there 
is null key in the build side (we know it at the driver side).
   
   in the very beginning, i am using a scala HashSet to store these 
singleColumn data, but committer suggest that I should take advantage of 
HashedRelation API, so after that, we are moving on to HashedRelation.




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