maropu commented on a change in pull request #25766: [SPARK-29061][SQL] Prints
bytecode statistics in debugCodegen
URL: https://github.com/apache/spark/pull/25766#discussion_r324009826
##########
File path:
sql/core/src/main/scala/org/apache/spark/sql/execution/debug/package.scala
##########
@@ -81,11 +82,21 @@ package object debug {
def writeCodegen(append: String => Unit, plan: SparkPlan): Unit = {
val codegenSeq = codegenStringSeq(plan)
append(s"Found ${codegenSeq.size} WholeStageCodegen subtrees.\n")
- for (((subtree, code), i) <- codegenSeq.zipWithIndex) {
- append(s"== Subtree ${i + 1} / ${codegenSeq.size} ==\n")
+ for (((subtree, code, codeStats), i) <- codegenSeq.zipWithIndex) {
+ val usedConstPoolRatio = if (codeStats.maxConstPoolSize > 0) {
+ val rt = 100.0 * codeStats.maxConstPoolSize /
CodeGenerator.MAX_JVM_CONSTANT_POOL_SIZE
+ "(%.2f%% used)".format(rt)
+ } else {
+ ""
+ }
+ val codeStatsStr = s"maxClassCodeSize:${codeStats.maxClassCodeSize}; " +
Review comment:
I added one more metric for the ratio of an used constant pool like
`maxConstantPoolSize:130(0.20% used)`;
```
scala> sql("SELECT sum(v) FROM VALUES(1) t(v)").debugCodegen
Found 2 WholeStageCodegen subtrees.
== Subtree 1 / 2 (maxClassCodeSize:2693; maxMethodCodeSize:124;
maxConstantPoolSize:130(0.20% used); numInnerClasses:0) ==
*(1) HashAggregate(keys=[], functions=[partial_sum(cast(v#0 as bigint))],
output=[sum#5L])
+- *(1) LocalTableScan [v#0]
```
cc: @rednaxelafx @kiszk
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]