aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorReynold Xin <rxin@apache.org>2014-06-08 18:39:57 -0700
committerReynold Xin <rxin@apache.org>2014-06-08 18:39:57 -0700
commit219dc00b30c8d9c4c0a6ce5d566497a93f21cb57 (patch)
tree7f82e34deee7dfc25cb2839df008b9f22f9971ac
parente9261d0866a610eab29fa332726186b534d1018f (diff)
downloadspark-219dc00b30c8d9c4c0a6ce5d566497a93f21cb57.tar.gz
spark-219dc00b30c8d9c4c0a6ce5d566497a93f21cb57.tar.bz2
spark-219dc00b30c8d9c4c0a6ce5d566497a93f21cb57.zip
SPARK-1628 follow up: Improve RangePartitioner's documentation.
Adding a paragraph clarifying a weird behavior in RangePartitioner. See also #549. Author: Reynold Xin <rxin@apache.org> Closes #1012 from rxin/partitioner-doc and squashes the following commits: 6f0109e [Reynold Xin] SPARK-1628 follow up: Improve RangePartitioner's documentation.
-rw-r--r--core/src/main/scala/org/apache/spark/Partitioner.scala5
1 files changed, 4 insertions, 1 deletions
diff --git a/core/src/main/scala/org/apache/spark/Partitioner.scala b/core/src/main/scala/org/apache/spark/Partitioner.scala
index 01e918fabe..e7f7548193 100644
--- a/core/src/main/scala/org/apache/spark/Partitioner.scala
+++ b/core/src/main/scala/org/apache/spark/Partitioner.scala
@@ -90,6 +90,10 @@ class HashPartitioner(partitions: Int) extends Partitioner {
/**
* A [[org.apache.spark.Partitioner]] that partitions sortable records by range into roughly
* equal ranges. The ranges are determined by sampling the content of the RDD passed in.
+ *
+ * Note that the actual number of partitions created by the RangePartitioner might not be the same
+ * as the `partitions` parameter, in the case where the number of sampled records is less than
+ * the value of `partitions`.
*/
class RangePartitioner[K : Ordering : ClassTag, V](
partitions: Int,
@@ -158,7 +162,6 @@ class RangePartitioner[K : Ordering : ClassTag, V](
false
}
-
override def hashCode(): Int = {
val prime = 31
var result = 1