Github user cloud-fan commented on a diff in the pull request:

    https://github.com/apache/spark/pull/19940#discussion_r156051417
  
    --- 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 --
    
    How can we support different initCode for the same name?


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to