Skip to content

Commit bfabf88

Browse files
author
Ilya Ganelin
committed
Changed to using a foreach vs. getorelse
1 parent 3e059b0 commit bfabf88

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

core/src/main/scala/org/apache/spark/shuffle/sort/SortShuffleWriter.scala

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,8 @@ private[spark] class SortShuffleWriter[K, V, C](
9090
if (sorter != null) {
9191
val startTime = System.nanoTime()
9292
sorter.stop()
93-
context.taskMetrics().shuffleWriteMetrics.getOrElse({
94-
metrics : ShuffleWriteMetrics =>
95-
metrics.incShuffleWriteTime(System.nanoTime()-startTime)
96-
},Nil)
93+
context.taskMetrics.shuffleWriteMetrics.foreach(
94+
_.incShuffleWriteTime(System.nanoTime - startTime))
9795
sorter = null
9896
}
9997
}

0 commit comments

Comments
 (0)