Skip to content

Commit 10d0cf0

Browse files
author
maji2014
committed
change a elegant way
1 parent d8f52dc commit 10d0cf0

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ private[spark] class HashShuffleReader[K, C](
4545
} else {
4646
new InterruptibleIterator(context, dep.aggregator.get.combineValuesByKey(iter, context))
4747
}
48-
} else if (dep.mapSideCombine) {
49-
throw new IllegalStateException("Aggregator is empty for map-side combine")
5048
} else {
49+
require(!dep.mapSideCombine, "Map-side combine without Aggregator specified!")
50+
5151
// Convert the Product2s to pairs since this is what downstream RDDs currently expect
5252
iter.asInstanceOf[Iterator[Product2[K, C]]].map(pair => (pair._1, pair._2))
5353
}

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,8 @@ private[spark] class HashShuffleWriter[K, V](
5656
} else {
5757
records
5858
}
59-
} else if (dep.mapSideCombine) {
60-
throw new IllegalStateException("Aggregator is empty for map-side combine")
6159
} else {
60+
require(!dep.mapSideCombine, "Map-side combine without Aggregator specified!")
6261
records
6362
}
6463

0 commit comments

Comments
 (0)