public class TotalOrderPartitioner<K extends org.apache.hadoop.io.WritableComparable,V> extends java.lang.Object implements Partitioner<K,V>
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
DEFAULT_PATH |
| Constructor and Description |
|---|
TotalOrderPartitioner() |
| Modifier and Type | Method and Description |
|---|---|
void |
configure(JobConf job)
Read in the partition file and build indexing data structures.
|
int |
getPartition(K key,
V value,
int numPartitions)
Get the paritition number for a given key (hence record) given the total
number of partitions i.e.
|
static java.lang.String |
getPartitionFile(JobConf job)
Get the path to the SequenceFile storing the sorted partition keyset.
|
static void |
setPartitionFile(JobConf job,
org.apache.hadoop.fs.Path p)
Set the path to the SequenceFile storing the sorted partition keyset.
|
public static final java.lang.String DEFAULT_PATH
public void configure(JobConf job)
BinaryComparable and
total.order.partitioner.natural.order is not false, a trie
of the first total.order.partitioner.max.trie.depth(2) + 1 bytes
will be built. Otherwise, keys will be located using a binary search of
the partition keyset using the RawComparator
defined for this job. The input file must be sorted with the same
comparator and contain JobConf.getNumReduceTasks() - 1 keys.configure in interface JobConfigurablejob - the configurationpublic int getPartition(K key, V value, int numPartitions)
PartitionerTypically a hash function on a all or a subset of the key.
getPartition in interface Partitioner<K extends org.apache.hadoop.io.WritableComparable,V>key - the key to be paritioned.value - the entry value.numPartitions - the total number of partitions.key.public static void setPartitionFile(JobConf job, org.apache.hadoop.fs.Path p)
public static java.lang.String getPartitionFile(JobConf job)
setPartitionFile(JobConf,Path)Copyright © 2009 The Apache Software Foundation