leanken commented on a change in pull request #29104:
URL: https://github.com/apache/spark/pull/29104#discussion_r459789858
##########
File path:
sql/core/src/main/scala/org/apache/spark/sql/execution/joins/BroadcastHashJoinExec.scala
##########
@@ -453,6 +494,47 @@ case class BroadcastHashJoinExec(
val (keyEv, anyNull) = genStreamSideJoinKey(ctx, input)
val (matched, checkCondition, _) = getJoinCondition(ctx, input)
val numOutput = metricTerm(ctx, "numOutputRows")
+ val isLongHashedRelation =
broadcastRelation.value.isInstanceOf[LongHashedRelation]
+
+ // fast stop if isOriginInputEmpty = true
+ // whether isNullAwareAntiJoin is true or false
+ // should accept all rows in streamedSide
+ if (broadcastRelation.value.isOriginInputEmpty) {
+ return s"""
+ |// Common Anti Join isOriginInputEmpty(true) accept all
+ |$numOutput.add(1);
+ |${consume(ctx, input)}
+ """.stripMargin
+ }
+
+ if (isNullAwareAntiJoin) {
+ if (broadcastRelation.value.allNullColumnKeyExistsInOriginInput) {
+ return s"""
+ |// NAAJ isOriginInputEmpty(false) anyNullKeyExists(true)
reject all
+ """.stripMargin
+ } else {
+ val found = ctx.freshName("found")
+ return s"""
+ |// NAAJ isOriginInputEmpty(false)
allNullColumnKeyExistsInOriginInput(false)
+ |boolean $found = false;
+ |// generate join key for stream side
+ |${keyEv.code}
+ |if (${ if (isLongHashedRelation) s"$anyNull" else
s"${keyEv.value}.allNull()"}) {
Review comment:
Why is one branch of the code checking for anyNull, and the other
allNull ?
because in LongHashedRelation
kevEv.value it a java long type, it certainly could not call allNull
as in UnsafeHashedRelation
kevEv.value is a UnsafeRow, this is why separately branch needed.
anyway, I will drop these code to remain "single column" focussed
----------------------------------------------------------------
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]