gengliangwang commented on code in PR #57058:
URL: https://github.com/apache/spark/pull/57058#discussion_r3592596311


##########
sql/core/src/main/scala/org/apache/spark/sql/execution/SortExec.scala:
##########
@@ -212,3 +206,27 @@ case class SortExec(
   override protected def withNewChildInternal(newChild: SparkPlan): SortExec =
     copy(child = newChild)
 }
+
+object SortExec {
+  /**
+   * Records the sort metrics (sort time, peak memory and spill size) for a 
completed sort. This
+   * is called both by the interpreted path ([[SortExec.doExecute]]) and by 
the generated code of
+   * [[SortExec.doProduce]], so the type-independent metric bookkeeping is 
compiled once per JVM
+   * instead of being re-emitted into every SortExec stage's generated code.
+   *
+   * `spillSizeBefore` is the task's spilled-bytes count captured before the 
rows were fed to the
+   * sorter, so that `spillSize` reflects only this operator's contribution.
+   */
+  def recordSortMetrics(

Review Comment:
   thanks, updated



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to