diff options
author | Liang-Chi Hsieh <simonh@tw.ibm.com> | 2016-03-17 10:08:42 -0700 |
---|---|---|
committer | Davies Liu <davies.liu@gmail.com> | 2016-03-17 10:08:42 -0700 |
commit | 5f3bda6fe2def15a1960b0feab42b07950ce691f (patch) | |
tree | e336afe4d11d8686e79c5f56ad95a14d104d1a93 /sql/catalyst | |
parent | 637a78f1d3dff00658324de3887d75c5ccd857be (diff) | |
download | spark-5f3bda6fe2def15a1960b0feab42b07950ce691f.tar.gz spark-5f3bda6fe2def15a1960b0feab42b07950ce691f.tar.bz2 spark-5f3bda6fe2def15a1960b0feab42b07950ce691f.zip |
[SPARK-13838] [SQL] Clear variable code to prevent it to be re-evaluated 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 #11674 from viirya/avoid-reevaluate.
Diffstat (limited to 'sql/catalyst')
-rw-r--r-- | sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/BoundAttribute.scala | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/BoundAttribute.scala b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/BoundAttribute.scala index 0d249a118c..c1fd23f28d 100644 --- a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/BoundAttribute.scala +++ b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/BoundAttribute.scala @@ -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); |