Github user nongli commented on a diff in the pull request:
https://github.com/apache/spark/pull/9480#discussion_r44190096
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/codegen/CodeGenerator.scala
---
@@ -341,7 +440,18 @@ abstract class CodeGenerator[InType <: AnyRef, OutType
<: AnyRef] extends Loggin
protected def declareMutableStates(ctx: CodeGenContext): String = {
ctx.mutableStates.map { case (javaType, variableName, _) =>
s"private $javaType $variableName;"
- }.mkString("\n")
+ }.mkString("\n") + "\n" +
+ // Maintain the loaded value and isNull as member variables. This is
necessary if the codegen
+ // function is split across multiple functions.
+ // TODO: maintaining this as a local variable probably allows the
compiler to do better
+ // optimizations.
+ ctx.subExprEliminationStates.map { s => {
--- End diff --
I changed this code to just use mutable state.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]