Skip to content

Commit

Permalink
[SPARK-13838] [SQL] Clear variable code to prevent it to be re-evalua…
Browse files Browse the repository at this point in the history
…ted in BoundAttribute

JIRA: https://issues.apache.org/jira/browse/SPARK-13838
## What changes were proposed in this pull request?

We should also clear the variable code in `BoundReference.genCode` to prevent it  to be evaluated twice, as we did in `evaluateVariables`.

## How was this patch tested?

Existing tests.

Author: Liang-Chi Hsieh <simonh@tw.ibm.com>

Closes apache#11674 from viirya/avoid-reevaluate.
  • Loading branch information
viirya authored and roygao94 committed Mar 22, 2016
1 parent 10c2723 commit 85f405d
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ case class BoundReference(ordinal: Int, dataType: DataType, nullable: Boolean)
val oev = ctx.currentVars(ordinal)
ev.isNull = oev.isNull
ev.value = oev.value
oev.code
val code = oev.code
oev.code = ""
code
} else if (nullable) {
s"""
boolean ${ev.isNull} = ${ctx.INPUT_ROW}.isNullAt($ordinal);
Expand Down

0 comments on commit 85f405d

Please sign in to comment.