Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ class CodegenContext {
mutable.Map(outerClassName -> mutable.Map.empty[String, String])

// Verbatim extra code to be added to the OuterClass.
private val extraCode: mutable.ListBuffer[String] = mutable.ListBuffer[String]()
private val extraClasses: mutable.ListBuffer[String] = mutable.ListBuffer[String]()

// Returns the size of the most recently added class.
private def currClassSize(): Int = classSize(classes.head._1)
Expand Down Expand Up @@ -335,16 +335,15 @@ class CodegenContext {
* Emits any source code added with addExtraCode
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Emits extra classes added ...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Emits extra inner classes added ...

*/
def emitExtraCode(): String = {
extraCode.mkString("\n")
extraClasses.mkString("\n")
}

/**
* Add extra source code to the outermost generated class.
* @param code verbatim source code to be added.
* @param code verbatim source code of the inner class to be added.
*/
def addExtraCode(code: String): Unit = {
extraCode.append(code)
classSize(outerClassName) += code.length
def addInnerClass(code: String): Unit = {
extraClasses.append(code)
}

final val JAVA_BOOLEAN = "boolean"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,7 @@ case class HashAggregateExec(
}
} else ""
}
ctx.addExtraCode(generateGenerateCode())
ctx.addInnerClass(generateGenerateCode())

val doAgg = ctx.freshName("doAggregateWithKeys")
val peakMemory = metricTerm(ctx, "peakMemory")
Expand Down