attilapiros commented on a change in pull request #24127: [SPARK-27186][CORE] 
optimize sortshuffle write
URL: https://github.com/apache/spark/pull/24127#discussion_r268293563
 
 

 ##########
 File path: 
core/src/main/scala/org/apache/spark/shuffle/sort/SortShuffleWriter.scala
 ##########
 @@ -49,6 +49,14 @@ private[spark] class SortShuffleWriter[K, V, C](
 
   /** Write a bunch of records to this task's output */
   override def write(records: Iterator[Product2[K, V]]): Unit = {
+
+    if (!records.hasNext) {
+      val partitionLengths = new Array[Long](dep.partitioner.numPartitions)
+      shuffleBlockResolver.writeIndexFileAndCommit(dep.shuffleId, mapId, 
partitionLengths, null)
+      mapStatus = MapStatus(blockManager.shuffleServerId, partitionLengths)
+      return;
 
 Review comment:
   Nit: semi colon must be removed

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

Reply via email to