We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 897c628 commit d5e3df8Copy full SHA for d5e3df8
core/src/main/scala/org/apache/spark/Partitioner.scala
@@ -76,6 +76,10 @@ object Partitioner {
76
* produce an unexpected or incorrect result.
77
*/
78
class HashPartitioner(partitions: Int) extends Partitioner {
79
+ if (partitions < 1) {
80
+ throw new IllegalArgumentException(s"Number of partitions ($partitions) must be positive.")
81
+ }
82
+
83
def numPartitions: Int = partitions
84
85
def getPartition(key: Any): Int = key match {
0 commit comments