public class HashPartitioner extends Partitioner
Partitioner that implements hash-based partitioning using
Java's Object.hashCode.
Java arrays have hashCodes that are based on the arrays' identities rather than their contents, so attempting to partition an RDD[Array[_} or RDD[(Array[_], _)] using a HashPartitioner will produce an unexpected or incorrect result.
| Constructor and Description |
|---|
HashPartitioner(int partitions) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(java.lang.Object other) |
int |
getPartition(java.lang.Object key) |
int |
hashCode() |
int |
numPartitions() |
defaultPartitionerpublic int numPartitions()
numPartitions in class Partitionerpublic int getPartition(java.lang.Object key)
getPartition in class Partitionerpublic boolean equals(java.lang.Object other)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Object