Skip to content

Commit a1ffbad

Browse files
sameeragarwalrxin
authored andcommitted
[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 #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 #14168 Author: Sameer Agarwal <sameerag@cs.berkeley.edu> Closes #14227 from sameeragarwal/codegen.
1 parent b2f24f9 commit a1ffbad

File tree

1 file changed

+3
-0
lines changed
  • sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions

1 file changed

+3
-0
lines changed

sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/Expression.scala

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,7 @@ abstract class UnaryExpression extends Expression {
377377
""")
378378
} else {
379379
ev.copy(code = s"""
380+
boolean ${ev.isNull} = false;
380381
${childGen.code}
381382
${ctx.javaType(dataType)} ${ev.value} = ${ctx.defaultValue(dataType)};
382383
$resultCode""", isNull = "false")
@@ -475,6 +476,7 @@ abstract class BinaryExpression extends Expression {
475476
""")
476477
} else {
477478
ev.copy(code = s"""
479+
boolean ${ev.isNull} = false;
478480
${leftGen.code}
479481
${rightGen.code}
480482
${ctx.javaType(dataType)} ${ev.value} = ${ctx.defaultValue(dataType)};
@@ -617,6 +619,7 @@ abstract class TernaryExpression extends Expression {
617619
$nullSafeEval""")
618620
} else {
619621
ev.copy(code = s"""
622+
boolean ${ev.isNull} = false;
620623
${leftGen.code}
621624
${midGen.code}
622625
${rightGen.code}

0 commit comments

Comments
 (0)