cloud-fan commented on a change in pull request #29975:
URL: https://github.com/apache/spark/pull/29975#discussion_r503050704
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/codegen/CodeGenerator.scala
##########
@@ -1761,16 +1772,21 @@ object CodeGenerator extends Logging {
case ref: BoundReference if ctx.currentVars != null &&
ctx.currentVars(ref.ordinal) != null =>
- val ExprCode(_, isNull, value) = ctx.currentVars(ref.ordinal)
- collectLocalVariable(value)
- collectLocalVariable(isNull)
+ val exprCode = ctx.currentVars(ref.ordinal)
+ // If the referred variable is not evaluated yet.
+ if (exprCode.code != EmptyBlock) {
+ exprCodesNeedEvaluate += exprCode.copy()
Review comment:
> We need to empty code of exprCode so we don't re-evaluate the code.
AFAIK when we empty the code, we also do a copy, right?
----------------------------------------------------------------
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]