Github user cloud-fan commented on a diff in the pull request:
https://github.com/apache/spark/pull/19811#discussion_r157153467
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/codegen/CodeGenerator.scala
---
@@ -1039,9 +1127,8 @@ 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)};")
+ addMutableState(JAVA_BOOLEAN, isNull, forceInline = true,
useFreshName = false)
+ addMutableState(javaType(expr.dataType), value, forceInline = true,
useFreshName = false)
--- End diff --
actually we can use fresh name here. just do
```
val isNull = freshName("subExprIsNull")
val value = freshName("subExprIsValue")
val fn = ...
```
at the beginning
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]