File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed
core/src/main/scala/org/apache/spark/rdd Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -69,7 +69,7 @@ private[spark] case class CoalescedRDDPartition(
6969 * the preferred location of each new partition overlaps with as many preferred locations of its
7070 * parent partitions
7171 * @param prev RDD to be coalesced
72- * @param maxPartitions number of desired partitions in the coalesced RDD
72+ * @param maxPartitions number of desired partitions in the coalesced RDD (must be positive)
7373 * @param balanceSlack used to trade-off balance and locality. 1.0 is all locality, 0 is all balance
7474 */
7575private [spark] class CoalescedRDD [T : ClassTag ](
@@ -78,6 +78,10 @@ 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+ }
84+
8185 override def getPartitions : Array [Partition ] = {
8286 val pc = new PartitionCoalescer (maxPartitions, prev, balanceSlack)
8387
You can’t perform that action at this time.
0 commit comments