Github user cloud-fan commented on a diff in the pull request:
https://github.com/apache/spark/pull/19813#discussion_r154573755
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/codegen/CodeGenerator.scala
---
@@ -1001,16 +1017,25 @@ class CodegenContext {
commonExprs.foreach { e =>
val expr = e.head
val fnName = freshName("evalExpr")
- val isNull = s"${fnName}IsNull"
+ val isNull = if (expr.nullable) {
+ s"${fnName}IsNull"
+ } else {
+ ""
+ }
val value = s"${fnName}Value"
// Generate the code for this expression tree and wrap it in a
function.
val eval = expr.genCode(this)
+ val nullValue = if (expr.nullable) {
+ s"$isNull = ${eval.isNull};"
--- End diff --
nit:
```
val setIsNull = if (expr.nullable) {
s"${fnName}IsNull = ${eval.isNull};"
} else ""
```
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]