Repository: spark Updated Branches: refs/heads/master 637a78f1d -> 5f3bda6fe
[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 <[email protected]> Closes #11674 from viirya/avoid-reevaluate. Project: http://git-wip-us.apache.org/repos/asf/spark/repo Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/5f3bda6f Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/5f3bda6f Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/5f3bda6f Branch: refs/heads/master Commit: 5f3bda6fe2def15a1960b0feab42b07950ce691f Parents: 637a78f Author: Liang-Chi Hsieh <[email protected]> Authored: Thu Mar 17 10:08:42 2016 -0700 Committer: Davies Liu <[email protected]> Committed: Thu Mar 17 10:08:42 2016 -0700 ---------------------------------------------------------------------- .../apache/spark/sql/catalyst/expressions/BoundAttribute.scala | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/spark/blob/5f3bda6f/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/BoundAttribute.scala ---------------------------------------------------------------------- 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 0d249a1..c1fd23f 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); --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
