Skip to content

Commit 6f6d511

Browse files
committed
Revert change for getJoinCondition and address nit comment
1 parent 4d26e49 commit 6f6d511

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

sql/core/src/main/scala/org/apache/spark/sql/execution/joins/JoinCodegenSupport.scala

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,20 +37,19 @@ trait JoinCodegenSupport extends CodegenSupport with BaseJoinExec {
3737
*/
3838
protected def getJoinCondition(
3939
ctx: CodegenContext,
40-
input: Seq[ExprCode],
41-
streamedPlan: SparkPlan,
40+
streamVars: Seq[ExprCode],
41+
streamPlan: SparkPlan,
4242
buildPlan: SparkPlan): (String, String, Seq[ExprCode]) = {
4343
val buildRow = ctx.freshName("buildRow")
4444
val buildVars = genBuildSideVars(ctx, buildRow, buildPlan)
4545
val checkCondition = if (condition.isDefined) {
4646
val expr = condition.get
47-
val outputs = streamedPlan.output ++ buildPlan.output
48-
val vars = input ++ buildVars
49-
// evaluate the variables used by condition
50-
val eval = evaluateRequiredVariables(outputs, vars, expr.references)
47+
// evaluate the variables from build side that used by condition
48+
val eval = evaluateRequiredVariables(buildPlan.output, buildVars, expr.references)
5149
// filter the output via condition
52-
ctx.currentVars = vars
53-
val ev = BindReferences.bindReference(expr, outputs).genCode(ctx)
50+
ctx.currentVars = streamVars ++ buildVars
51+
val ev =
52+
BindReferences.bindReference(expr, streamPlan.output ++ buildPlan.output).genCode(ctx)
5453
val skipRow = s"${ev.isNull} || !${ev.value}"
5554
s"""
5655
|$eval

0 commit comments

Comments
 (0)