@@ -74,7 +74,7 @@ final class UnsafeShuffleExternalSorter {
7474 private final ShuffleWriteMetrics writeMetrics ;
7575
7676 /** The buffer size to use when writing spills using DiskBlockObjectWriter */
77- private final int fileBufferSize ;
77+ private final int fileBufferSizeBytes ;
7878
7979 /**
8080 * Memory pages that hold the records being sorted. The pages in this list are freed when
@@ -108,8 +108,9 @@ public UnsafeShuffleExternalSorter(
108108 this .initialSize = initialSize ;
109109 this .numPartitions = numPartitions ;
110110 this .spillingEnabled = conf .getBoolean ("spark.shuffle.spill" , true );
111- // Use getSizeAsKb (not bytes) to maintain backwards compatibility for units
112- this .fileBufferSize = (int ) conf .getSizeAsKb ("spark.shuffle.file.buffer" , "32k" ) * 1024 ;
111+ // Use getSizeAsKb (not bytes) to maintain backwards compatibility if no units are provided
112+ this .fileBufferSizeBytes = (int ) conf .getSizeAsKb ("spark.shuffle.file.buffer" , "32k" ) * 1024 ;
113+
113114 this .writeMetrics = writeMetrics ;
114115 initializeForWriting ();
115116 }
@@ -182,7 +183,7 @@ private void writeSortedFile(boolean isLastFile) throws IOException {
182183 // around this, we pass a dummy no-op serializer.
183184 final SerializerInstance ser = DummySerializerInstance .INSTANCE ;
184185
185- writer = blockManager .getDiskWriter (blockId , file , ser , fileBufferSize , writeMetricsToUse );
186+ writer = blockManager .getDiskWriter (blockId , file , ser , fileBufferSizeBytes , writeMetricsToUse );
186187
187188 int currentPartition = -1 ;
188189 while (sortedRecords .hasNext ()) {
@@ -196,7 +197,8 @@ private void writeSortedFile(boolean isLastFile) throws IOException {
196197 spillInfo .partitionLengths [currentPartition ] = writer .fileSegment ().length ();
197198 }
198199 currentPartition = partition ;
199- writer = blockManager .getDiskWriter (blockId , file , ser , fileBufferSize , writeMetricsToUse );
200+ writer =
201+ blockManager .getDiskWriter (blockId , file , ser , fileBufferSizeBytes , writeMetricsToUse );
200202 }
201203
202204 final long recordPointer = sortedRecords .packedRecordPointer .getRecordPointer ();
0 commit comments