You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by da...@apache.org on 2016/03/17 18:09:02 UTC

spark git commit: [SPARK-13838] [SQL] Clear variable code to prevent it to be re-evaluated in BoundAttribute

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 <si...@tw.ibm.com>

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 <si...@tw.ibm.com>
Authored: Thu Mar 17 10:08:42 2016 -0700
Committer: Davies Liu <da...@gmail.com>
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: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org