public class RangePartitioner<K,V> extends Partitioner
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
.
Constructor and Description |
---|
RangePartitioner(int partitions,
RDD<? extends scala.Product2<K,V>> rdd,
boolean ascending,
scala.math.Ordering<K> evidence$1,
scala.reflect.ClassTag<K> evidence$2) |
Modifier and Type | Method and Description |
---|---|
static <K> java.lang.Object |
determineBounds(scala.collection.mutable.ArrayBuffer<scala.Tuple2<K,java.lang.Object>> candidates,
int partitions,
scala.math.Ordering<K> evidence$4,
scala.reflect.ClassTag<K> evidence$5)
Determines the bounds for range partitioning from candidates with weights indicating how many
items each represents.
|
boolean |
equals(java.lang.Object other) |
int |
getPartition(java.lang.Object key) |
int |
hashCode() |
int |
numPartitions() |
static <K> scala.Tuple2<java.lang.Object,scala.Tuple3<java.lang.Object,java.lang.Object,java.lang.Object>[]> |
sketch(RDD<K> rdd,
int sampleSizePerPartition,
scala.reflect.ClassTag<K> evidence$3)
Sketches the input RDD via reservoir sampling on each partition.
|
defaultPartitioner
public static <K> scala.Tuple2<java.lang.Object,scala.Tuple3<java.lang.Object,java.lang.Object,java.lang.Object>[]> sketch(RDD<K> rdd, int sampleSizePerPartition, scala.reflect.ClassTag<K> evidence$3)
rdd
- the input RDD to sketchsampleSizePerPartition
- max sample size per partitionevidence$3
- (undocumented)public static <K> java.lang.Object determineBounds(scala.collection.mutable.ArrayBuffer<scala.Tuple2<K,java.lang.Object>> candidates, int partitions, scala.math.Ordering<K> evidence$4, scala.reflect.ClassTag<K> evidence$5)
candidates
- unordered candidates with weightspartitions
- number of partitionsevidence$4
- (undocumented)evidence$5
- (undocumented)public int numPartitions()
numPartitions
in class Partitioner
public int getPartition(java.lang.Object key)
getPartition
in class Partitioner
public boolean equals(java.lang.Object other)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object