diff options
author | Sameer Agarwal <sameerag@cs.berkeley.edu> | 2016-07-16 13:24:00 -0700 |
---|---|---|
committer | Reynold Xin <rxin@databricks.com> | 2016-07-16 13:24:00 -0700 |
commit | a1ffbada8a266a4130de6fffc4a5efd085a29ae4 (patch) | |
tree | f859dd061b42e7b65f8ea59449f22c16d79a3991 /sql/catalyst/src/main/scala | |
parent | b2f24f94591082d3ff82bd3db1760b14603b38aa (diff) | |
download | spark-a1ffbada8a266a4130de6fffc4a5efd085a29ae4.tar.gz spark-a1ffbada8a266a4130de6fffc4a5efd085a29ae4.tar.bz2 spark-a1ffbada8a266a4130de6fffc4a5efd085a29ae4.zip |
[SPARK-16582][SQL] Explicitly define isNull = false for non-nullable expressions
## What changes were proposed in this pull request?
This patch is just a slightly safer way to fix the issue we encountered in https://github.com/apache/spark/pull/14168 should this pattern re-occur at other places in the code.
## How was this patch tested?
Existing tests. Also, I manually tested that it fixes the problem in SPARK-16514 without having the proposed change in https://github.com/apache/spark/pull/14168
Author: Sameer Agarwal <sameerag@cs.berkeley.edu>
Closes #14227 from sameeragarwal/codegen.
Diffstat (limited to 'sql/catalyst/src/main/scala')
-rw-r--r-- | sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/Expression.scala | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/Expression.scala b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/Expression.scala index 10a141254f..1f37b68846 100644 --- a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/Expression.scala +++ b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/Expression.scala @@ -377,6 +377,7 @@ abstract class UnaryExpression extends Expression { """) } else { ev.copy(code = s""" + boolean ${ev.isNull} = false; ${childGen.code} ${ctx.javaType(dataType)} ${ev.value} = ${ctx.defaultValue(dataType)}; $resultCode""", isNull = "false") @@ -475,6 +476,7 @@ abstract class BinaryExpression extends Expression { """) } else { ev.copy(code = s""" + boolean ${ev.isNull} = false; ${leftGen.code} ${rightGen.code} ${ctx.javaType(dataType)} ${ev.value} = ${ctx.defaultValue(dataType)}; @@ -617,6 +619,7 @@ abstract class TernaryExpression extends Expression { $nullSafeEval""") } else { ev.copy(code = s""" + boolean ${ev.isNull} = false; ${leftGen.code} ${midGen.code} ${rightGen.code} |