spark-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mgaido91 <...@git.apache.org>
Subject [GitHub] spark pull request #19940: [SPARK-22750][SQL] Reuse mutable states when poss...
Date Mon, 11 Dec 2017 12:19:23 GMT
Github user mgaido91 commented on a diff in the pull request:

    https://github.com/apache/spark/pull/19940#discussion_r156057818
  
    --- 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 = {
    +    if (!singleMutableStates.contains(variableName)) {
    +      addMutableState(javaType, variableName, initCode)
    --- End diff --
    
    if you want, I can add it.


---

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


Mime
View raw message