Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -259,8 +259,8 @@ case class FilterExec(condition: Expression, child: SparkPlan)
val boundOtherPreds = otherPreds.map(
BindReferences.bindReference(_, output))
// Pre-evaluate input variables before CSE analysis: CSE clears
// ctx.currentVars[i].code as a side effect, which causes "is not an rvalue"
// errors if notNullPreds reference the same inputs.
// ctx.currentVars[i].code as a side effect; without this pre-evaluation, Janino fails
// with "Unknown variable or type" when notNullPreds reference the same input columns.
val otherPredInputAttrs = AttributeSet(otherPreds.flatMap(_.references))
val inputVarsEvalCode = evaluateRequiredVariables(
child.output, input, otherPredInputAttrs)
Expand All @@ -275,6 +275,13 @@ case class FilterExec(condition: Expression, child: SparkPlan)
}
code
}
// Note: subExprs.exprCodesNeedEvaluate is intentionally not used here, unlike ProjectExec.
// evaluateRequiredVariables above cleared input[i].code = EmptyBlock for all
// otherPredInputAttrs before CSE analysis ran, so getLocalInputVariableValues never
// adds them to exprCodesNeedEvaluate -- it is always empty. Do NOT replace the
// pre-evaluation above with evaluateVariables(subExprs.exprCodesNeedEvaluate):
// that would leave notNullPreds referencing undeclared variables (Janino: "Unknown
// variable or type") for any input column shared between notNullPreds and otherPreds.
(inputVarsEvalCode, ctx.evaluateSubExprEliminationState(subExprs.states.values), predCode)
} else {
("", "", generatePredicateCode(
Expand Down