cloud-fan commented on a change in pull request #31931:
URL: https://github.com/apache/spark/pull/31931#discussion_r599312638
##########
File path:
sql/core/src/main/scala/org/apache/spark/sql/execution/joins/BroadcastNestedLoopJoinExec.scala
##########
@@ -458,6 +460,49 @@ case class BroadcastNestedLoopJoinExec(
""".stripMargin
}
+ private def codegenOuter(ctx: CodegenContext, input: Seq[ExprCode]): String
= {
+ val (buildRowArray, buildRowArrayTerm) = prepareBroadcast(ctx)
+ val (buildRow, checkCondition, _) = getJoinCondition(ctx, input, streamed,
broadcast)
+ val buildVars = genBuildSideVars(ctx, buildRow, broadcast)
+
+ val resultVars = buildSide match {
+ case BuildLeft => buildVars ++ input
+ case BuildRight => input ++ buildVars
+ }
+ val arrayIndex = ctx.freshName("arrayIndex")
+ val shouldOutputRow = ctx.freshName("shouldOutputRow")
+ val foundMatch = ctx.freshName("foundMatch")
+ val numOutput = metricTerm(ctx, "numOutputRows")
+
+ if (buildRowArray.isEmpty) {
+ s"""
+ |UnsafeRow $buildRow = null;
+ |$numOutput.add(1);
+ |${consume(ctx, resultVars)}
+ """.stripMargin
+ } else {
+ s"""
+ |boolean $foundMatch = false;
Review comment:
we can declare this variable inside the for loop.
--
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]