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 <[email protected]>

Closes #11674 from viirya/avoid-reevaluate.
  • Loading branch information
viirya authored and davies committed Mar 17, 2016
1 parent 637a78f commit 5f3bda6
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 5f3bda6

Please sign in to comment.