leanken commented on a change in pull request #29104: URL: https://github.com/apache/spark/pull/29104#discussion_r459796329
########## File path: sql/core/src/main/scala/org/apache/spark/sql/execution/joins/BroadcastHashJoinExec.scala ########## @@ -133,10 +145,39 @@ 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 => + val hashed = broadcastRelation.value.asReadOnlyCopy() + TaskContext.get().taskMetrics().incPeakExecutionMemory(hashed.estimatedSize) + if (hashed.isOriginInputEmpty) { + streamedIter + } else if (hashed.allNullColumnKeyExistsInOriginInput) { + Iterator.empty + } else { + val keyGenerator = UnsafeProjection.create( + BindReferences.bindReferences[Expression]( + leftKeys, + AttributeSeq(left.output)) + ) + streamedIter.filter(row => { + val lookupKey: UnsafeRow = keyGenerator(row) + if (lookupKey.allNull()) { Review comment: done ########## File path: sql/core/src/main/scala/org/apache/spark/sql/execution/joins/BroadcastHashJoinExec.scala ########## @@ -46,14 +46,26 @@ case class BroadcastHashJoinExec( buildSide: BuildSide, condition: Option[Expression], left: SparkPlan, - right: SparkPlan) + right: SparkPlan, + isNullAwareAntiJoin: Boolean = false) extends HashJoin with CodegenSupport { + if (isNullAwareAntiJoin) { + // TODO support multi column NULL-aware anti join in future. Review comment: done ---------------------------------------------------------------- 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: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org