@@ -37,20 +37,19 @@ trait JoinCodegenSupport extends CodegenSupport with BaseJoinExec {
37
37
*/
38
38
protected def getJoinCondition (
39
39
ctx : CodegenContext ,
40
- input : Seq [ExprCode ],
41
- streamedPlan : SparkPlan ,
40
+ streamVars : Seq [ExprCode ],
41
+ streamPlan : SparkPlan ,
42
42
buildPlan : SparkPlan ): (String , String , Seq [ExprCode ]) = {
43
43
val buildRow = ctx.freshName(" buildRow" )
44
44
val buildVars = genBuildSideVars(ctx, buildRow, buildPlan)
45
45
val checkCondition = if (condition.isDefined) {
46
46
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)
51
49
// 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)
54
53
val skipRow = s " ${ev.isNull} || ! ${ev.value}"
55
54
s """
56
55
| $eval
0 commit comments