Skip to content

Commit

Permalink
Add a precondition check
Browse files Browse the repository at this point in the history
  • Loading branch information
rxin committed Sep 28, 2017
1 parent b46c92b commit df27868
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions core/src/main/scala/org/apache/spark/Partitioner.scala
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@ class RangePartitioner[K : Ordering : ClassTag, V](

// We allow partitions = 0, which happens when sorting an empty RDD under the default settings.
require(partitions >= 0, s"Number of partitions cannot be negative but found $partitions.")
require(samplePointsPerPartitionHint > 0,
s"Sample points per partition must be greater than 0 but found $samplePointsPerPartitionHint")

private var ordering = implicitly[Ordering[K]]

Expand Down

0 comments on commit df27868

Please sign in to comment.