Skip to content

Commit 3083d86

Browse files
committed
Fix style
1 parent 70f59db commit 3083d86

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

core/src/main/java/org/apache/spark/api/shuffle/ShuffleMapOutputWriter.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
import java.io.IOException;
2121

2222
import org.apache.spark.annotation.Experimental;
23-
import org.apache.spark.api.java.Optional;
2423

2524
/**
2625
* :: Experimental ::

core/src/main/java/org/apache/spark/shuffle/sort/BypassMergeSortShuffleWriter.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
import org.apache.spark.Partitioner;
4040
import org.apache.spark.ShuffleDependency;
4141
import org.apache.spark.SparkConf;
42-
import org.apache.spark.api.java.Optional;
4342
import org.apache.spark.api.shuffle.SupportsTransferTo;
4443
import org.apache.spark.api.shuffle.ShuffleMapOutputWriter;
4544
import org.apache.spark.api.shuffle.ShufflePartitionWriter;

core/src/main/java/org/apache/spark/shuffle/sort/io/DefaultShuffleMapOutputWriter.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,13 @@
2828
import org.slf4j.LoggerFactory;
2929

3030
import org.apache.spark.SparkConf;
31-
import org.apache.spark.api.java.Optional;
3231
import org.apache.spark.api.shuffle.ShuffleMapOutputWriter;
3332
import org.apache.spark.api.shuffle.ShufflePartitionWriter;
3433
import org.apache.spark.api.shuffle.SupportsTransferTo;
3534
import org.apache.spark.api.shuffle.TransferrableWritableByteChannel;
3635
import org.apache.spark.internal.config.package$;
3736
import org.apache.spark.shuffle.sort.DefaultTransferrableWritableByteChannel;
3837
import org.apache.spark.shuffle.ShuffleWriteMetricsReporter;
39-
import org.apache.spark.storage.BlockManagerId;
4038
import org.apache.spark.shuffle.IndexShuffleBlockResolver;
4139
import org.apache.spark.storage.TimeTrackingOutputStream;
4240
import org.apache.spark.util.Utils;

core/src/main/java/org/apache/spark/shuffle/sort/io/DefaultShuffleWriteSupport.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
import org.apache.spark.api.shuffle.ShuffleMapOutputWriter;
2323
import org.apache.spark.api.shuffle.ShuffleWriteSupport;
2424
import org.apache.spark.shuffle.IndexShuffleBlockResolver;
25-
import org.apache.spark.storage.BlockManagerId;
2625

2726
public class DefaultShuffleWriteSupport implements ShuffleWriteSupport {
2827

@@ -41,8 +40,13 @@ public ShuffleMapOutputWriter createMapOutputWriter(
4140
int shuffleId,
4241
int mapId,
4342
int numPartitions) {
43+
TaskContext taskContext = TaskContext.get();
44+
if (taskContext == null) {
45+
throw new IllegalStateException(
46+
"Task context must be set before creating a map output writer.");
47+
}
4448
return new DefaultShuffleMapOutputWriter(
4549
shuffleId, mapId, numPartitions,
46-
TaskContext.get().taskMetrics().shuffleWriteMetrics(), blockResolver, sparkConf);
50+
taskContext.taskMetrics().shuffleWriteMetrics(), blockResolver, sparkConf);
4751
}
4852
}

0 commit comments

Comments
 (0)