Github user viirya commented on a diff in the pull request:
https://github.com/apache/spark/pull/19813#discussion_r156287106
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/codegen/CodeGenerator.scala
---
@@ -1028,12 +1078,17 @@ class CodegenContext {
// 2. Less code.
// Currently, we will do this for all non-leaf only expression trees
(i.e. expr trees with
// at least two nodes) as the cost of doing it is expected to be low.
- addMutableState(JAVA_BOOLEAN, isNull, s"$isNull = false;")
- addMutableState(javaType(expr.dataType), value,
- s"$value = ${defaultValue(expr.dataType)};")
+ if (expr.nullable) {
+ addMutableState(JAVA_BOOLEAN, isNull)
+ }
+ addMutableState(javaType(expr.dataType), value)
subexprFunctions += s"${addNewFunction(fnName, fn)}($INPUT_ROW);"
- val state = SubExprEliminationState(isNull, value)
+ val state = if (expr.nullable) {
+ SubExprEliminationState(isNull, value)
--- End diff --
Because here it is not `SubExprEliminationState(ev.isNull, value)`.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]