Skip to content

Commit e67f1ea

Browse files
committed
Remove upper type bound in ShuffleWriter interface.
This bound wasn't necessary and was causing IntelliJ to display spurious errors when editing UnsafeShuffleWriter.java.
1 parent cfe0ec4 commit e67f1ea

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

core/src/main/java/org/apache/spark/shuffle/unsafe/UnsafeShuffleWriter.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,7 @@
4747
import org.apache.spark.unsafe.PlatformDependent;
4848
import org.apache.spark.unsafe.memory.TaskMemoryManager;
4949

50-
// IntelliJ gets confused and claims that this class should be abstract, but this actually compiles
51-
public class UnsafeShuffleWriter<K, V> implements ShuffleWriter<K, V> {
50+
public class UnsafeShuffleWriter<K, V> extends ShuffleWriter<K, V> {
5251

5352
private static final int SER_BUFFER_SIZE = 1024 * 1024; // TODO: tune this
5453
private static final ClassTag<Object> OBJECT_CLASS_TAG = ClassTag$.MODULE$.Object();
@@ -102,6 +101,7 @@ public void write(Iterator<Product2<K, V>> records) {
102101
write(JavaConversions.asScalaIterator(records));
103102
}
104103

104+
@Override
105105
public void write(scala.collection.Iterator<Product2<K, V>> records) {
106106
try {
107107
final long[] partitionLengths = mergeSpills(insertRecordsIntoSorter(records));

core/src/main/scala/org/apache/spark/shuffle/ShuffleWriter.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ import org.apache.spark.scheduler.MapStatus
2222
/**
2323
* Obtained inside a map task to write out records to the shuffle system.
2424
*/
25-
private[spark] trait ShuffleWriter[K, V] {
25+
private[spark] abstract class ShuffleWriter[K, V] {
2626
/** Write a sequence of records to this task's output */
27-
def write(records: Iterator[_ <: Product2[K, V]]): Unit
27+
def write(records: Iterator[Product2[K, V]]): Unit
2828

2929
/** Close this writer, passing along whether the map completed */
3030
def stop(success: Boolean): Option[MapStatus]

core/src/main/scala/org/apache/spark/shuffle/hash/HashShuffleWriter.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ private[spark] class HashShuffleWriter[K, V](
4949
writeMetrics)
5050

5151
/** Write a bunch of records to this task's output */
52-
override def write(records: Iterator[_ <: Product2[K, V]]): Unit = {
52+
override def write(records: Iterator[Product2[K, V]]): Unit = {
5353
val iter = if (dep.aggregator.isDefined) {
5454
if (dep.mapSideCombine) {
5555
dep.aggregator.get.combineValuesByKey(records, context)

core/src/main/scala/org/apache/spark/shuffle/sort/SortShuffleWriter.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ private[spark] class SortShuffleWriter[K, V, C](
4848
context.taskMetrics.shuffleWriteMetrics = Some(writeMetrics)
4949

5050
/** Write a bunch of records to this task's output */
51-
override def write(records: Iterator[_ <: Product2[K, V]]): Unit = {
51+
override def write(records: Iterator[Product2[K, V]]): Unit = {
5252
if (dep.mapSideCombine) {
5353
require(dep.aggregator.isDefined, "Map-side combine without Aggregator specified!")
5454
sorter = new ExternalSorter[K, V, C](

0 commit comments

Comments
 (0)