File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
core/src/main/java/org/apache/spark/shuffle/unsafe Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -258,8 +258,11 @@ private long[] mergeSpills(SpillInfo[] spills) throws IOException {
258258 logger .debug ("Using slow merge" );
259259 partitionLengths = mergeSpillsWithFileStream (spills , outputFile , compressionCodec );
260260 }
261- // The final shuffle spill's write would have directly updated shuffleBytesWritten, so
262- // we need to decrement to avoid double-counting this write.
261+ // When closing an UnsafeShuffleExternalSorter that has already spilled once but also has
262+ // in-memory records, we write out the in-memory records to a file but do not count that
263+ // final write as bytes spilled (instead, it's accounted as shuffle write). The merge needs
264+ // to be counted as shuffle write, but this will lead to double-counting of the final
265+ // SpillInfo's bytes.
263266 writeMetrics .decShuffleBytesWritten (spills [spills .length - 1 ].file .length ());
264267 writeMetrics .incShuffleBytesWritten (outputFile .length ());
265268 return partitionLengths ;
You can’t perform that action at this time.
0 commit comments