3737import org .apache .spark .Partitioner ;
3838import org .apache .spark .ShuffleDependency ;
3939import org .apache .spark .SparkConf ;
40- import org .apache .spark .TaskContext ;
41- import org .apache .spark .executor .ShuffleWriteMetrics ;
4240import org .apache .spark .scheduler .MapStatus ;
4341import org .apache .spark .scheduler .MapStatus$ ;
4442import org .apache .spark .serializer .Serializer ;
4543import org .apache .spark .serializer .SerializerInstance ;
44+ import org .apache .spark .shuffle .ShuffleWriteMetricsReporter ;
4645import org .apache .spark .shuffle .IndexShuffleBlockResolver ;
4746import org .apache .spark .shuffle .ShuffleWriter ;
4847import org .apache .spark .storage .*;
@@ -79,7 +78,7 @@ final class BypassMergeSortShuffleWriter<K, V> extends ShuffleWriter<K, V> {
7978 private final int numPartitions ;
8079 private final BlockManager blockManager ;
8180 private final Partitioner partitioner ;
82- private final ShuffleWriteMetrics writeMetrics ;
81+ private final ShuffleWriteMetricsReporter writeMetrics ;
8382 private final int shuffleId ;
8483 private final int mapId ;
8584 private final Serializer serializer ;
@@ -103,8 +102,8 @@ final class BypassMergeSortShuffleWriter<K, V> extends ShuffleWriter<K, V> {
103102 IndexShuffleBlockResolver shuffleBlockResolver ,
104103 BypassMergeSortShuffleHandle <K , V > handle ,
105104 int mapId ,
106- TaskContext taskContext ,
107- SparkConf conf ) {
105+ SparkConf conf ,
106+ ShuffleWriteMetricsReporter writeMetrics ) {
108107 // Use getSizeAsKb (not bytes) to maintain backwards compatibility if no units are provided
109108 this .fileBufferSize = (int ) conf .getSizeAsKb ("spark.shuffle.file.buffer" , "32k" ) * 1024 ;
110109 this .transferToEnabled = conf .getBoolean ("spark.file.transferTo" , true );
@@ -114,7 +113,7 @@ final class BypassMergeSortShuffleWriter<K, V> extends ShuffleWriter<K, V> {
114113 this .shuffleId = dep .shuffleId ();
115114 this .partitioner = dep .partitioner ();
116115 this .numPartitions = partitioner .numPartitions ();
117- this .writeMetrics = taskContext . taskMetrics (). shuffleWriteMetrics () ;
116+ this .writeMetrics = writeMetrics ;
118117 this .serializer = dep .serializer ();
119118 this .shuffleBlockResolver = shuffleBlockResolver ;
120119 }
0 commit comments