Github user srowen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/4965#discussion_r26351183
  
    --- Diff: 
core/src/main/scala/org/apache/spark/shuffle/sort/SortShuffleWriter.scala ---
    @@ -88,7 +88,12 @@ private[spark] class SortShuffleWriter[K, V, C](
         } finally {
           // Clean up our sorter, which may have its own intermediate files
           if (sorter != null) {
    +        val startTime = System.nanoTime()
             sorter.stop()
    +        context.taskMetrics().shuffleWriteMetrics.getOrElse({
    +          metrics : ShuffleWriteMetrics =>
    +            metrics.incShuffleWriteTime(System.nanoTime()-startTime)
    +        },Nil)
    --- End diff --
    
    OK. As a matter of style I think it would be better to...
    
    ```
    context.taskMetrics.shuffleWriteMetrics.foreach(
              _.incShuffleWriteTime(System.nanoTime - startTime))
    ```
    
    Which is what `ExternalSorter` does. This looks like the correct bit to 
time.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

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

Reply via email to