Skip to content
Snippets Groups Projects
Commit f21f6ce9 authored by Juliusz Sompolski's avatar Juliusz Sompolski Committed by gatorsmile
Browse files

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

## What changes were proposed in this pull request?

Address PR comments that appeared post-merge, to rename `addExtraCode` to `addInnerClass`,
and not count the size of the inner class to the size of the outer class.

## How was this patch tested?

YOLO.

Author: Juliusz Sompolski <julek@databricks.com>

Closes #19353 from juliuszsompolski/SPARK-22103followup.
parent 64fbd1ce
No related branches found
No related tags found
No related merge requests found
......@@ -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)
......@@ -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"
......
......@@ -621,7 +621,7 @@ case class HashAggregateExec(
}
} else ""
}
ctx.addExtraCode(generateGenerateCode())
ctx.addInnerClass(generateGenerateCode())
val doAgg = ctx.freshName("doAggregateWithKeys")
val peakMemory = metricTerm(ctx, "peakMemory")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment