Github user ueshin commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18075#discussion_r118866774
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/codegen/CodeGenerator.scala
 ---
    @@ -233,10 +222,128 @@ class CodegenContext {
       // The collection of sub-expression result resetting methods that need 
to be called on each row.
       val subexprFunctions = mutable.ArrayBuffer.empty[String]
     
    -  def declareAddedFunctions(): String = {
    -    addedFunctions.map { case (funcName, funcCode) => funcCode 
}.mkString("\n")
    +  /**
    +   * Holds the class and instance names to be generated. `OuterClass` is a 
placeholder standing for
    +   * whichever class is generated as the outermost class and which will 
contain any nested
    +   * sub-classes. All other classes and instance names in this list will 
represent private, nested
    +   * sub-classes.
    +   */
    +  private val classes: mutable.ListBuffer[(String, String)] =
    +    mutable.ListBuffer[(String, String)]("OuterClass" -> null)
    +
    +  // A map holding the current size in bytes of each class to be generated.
    +  private val classSize: mutable.Map[String, Int] =
    +    mutable.Map[String, Int]("OuterClass" -> 0)
    +
    +  // A map holding lists of functions belonging to their class.
    +  private val classFunctions: mutable.Map[String, 
mutable.ListBuffer[String]] =
    +    mutable.Map("OuterClass" -> mutable.ListBuffer.empty[String])
    +
    +  // Returns the size of the most recently added class.
    +  private def currClassSize(): Int = classSize(classes.head._1)
    +
    +  // Returns the class name and instance name for the most recently added 
class.
    +  private def currClass(): (String, String) = classes.head
    +
    +  // Adds a new class. Requires the class' name, and its instance name.
    +  private def addClass(className: String, classInstance: String): Unit = {
    +    classes.prepend(Tuple2(className, classInstance))
    --- End diff --
    
    nit: How about `classes.prepend((className, classInstance))` or 
`classes.prepend(className -> classInstance)`?


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

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

Reply via email to