Github user mgaido91 commented on a diff in the pull request:
https://github.com/apache/spark/pull/19940#discussion_r156052035
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/codegen/CodeGenerator.scala
---
@@ -184,6 +190,27 @@ class CodegenContext {
mutableStates += ((javaType, variableName, initCode))
}
+ /**
+ * Add a mutable state as a field to the generated class only if it does
not exist yet a field
+ * with that name. This helps reducing the number of the generated
class' fields, since the same
+ * variable can be reused by many functions.
+ *
+ * Internally, this method calls `addMutableState`.
+ *
+ * @param javaType Java type of the field.
+ * @param variableName Name of the field.
+ * @param initCode The statement(s) to put into the init() method to
initialize this field.
+ */
+ def addSingleMutableState(
+ javaType: String,
+ variableName: String,
+ initCode: String = ""): Unit = {
--- End diff --
It is not supported.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]