File tree Expand file tree Collapse file tree 2 files changed +2
-6
lines changed
core/src/main/scala/org/apache/spark Expand file tree Collapse file tree 2 files changed +2
-6
lines changed Original file line number Diff line number Diff line change @@ -76,9 +76,7 @@ object Partitioner {
7676 * produce an unexpected or incorrect result.
7777 */
7878class HashPartitioner (partitions : Int ) extends Partitioner {
79- if (partitions < 1 ) {
80- throw new IllegalArgumentException (s " Number of partitions ( $partitions) must be positive. " )
81- }
79+ require(partitions > 0 , s " Number of partitions ( $partitions) must be positive. " )
8280
8381 def numPartitions : Int = partitions
8482
Original file line number Diff line number Diff line change @@ -78,9 +78,7 @@ private[spark] class CoalescedRDD[T: ClassTag](
7878 balanceSlack : Double = 0.10 )
7979 extends RDD [T ](prev.context, Nil ) { // Nil since we implement getDependencies
8080
81- if (maxPartitions < 1 ) {
82- throw new IllegalArgumentException (s " Number of partitions ( $maxPartitions) must be positive. " )
83- }
81+ require(maxPartitions > 0 , s " Number of partitions ( $maxPartitions) must be positive. " )
8482
8583 override def getPartitions : Array [Partition ] = {
8684 val pc = new PartitionCoalescer (maxPartitions, prev, balanceSlack)
You can’t perform that action at this time.
0 commit comments