Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SPARK-22103][FOLLOWUP] Rename addExtraCode to addInnerClass #19353

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
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 @@ -332,19 +332,18 @@ class CodegenContext {
}

/**
* Emits any source code added with addExtraCode
* Emits extra inner classes added with addExtraCode
*/
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