Skip to content

Commit bf7b14d

Browse files
author
maji2014
committed
change a elegant way for SortShuffleWriter.scala
1 parent 10d0cf0 commit bf7b14d

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,7 @@ private[spark] class SortShuffleWriter[K, V, C](
5050
/** Write a bunch of records to this task's output */
5151
override def write(records: Iterator[_ <: Product2[K, V]]): Unit = {
5252
if (dep.mapSideCombine) {
53-
if (dep.aggregator.isEmpty) {
54-
throw new IllegalStateException("Aggregator is empty for map-side combine")
55-
}
53+
require(dep.aggregator.isDefined, "Map-side combine without Aggregator specified!")
5654
sorter = new ExternalSorter[K, V, C](
5755
dep.aggregator, Some(dep.partitioner), dep.keyOrdering, dep.serializer)
5856
sorter.insertAll(records)

0 commit comments

Comments
 (0)