public class TotalOrderPartitioner<K extends WritableComparable,V> extends Object implements Partitioner<K,V>
| 限定符和类型 | 字段和说明 |
|---|---|
static String |
DEFAULT_PATH |
| 构造器和说明 |
|---|
TotalOrderPartitioner() |
| 限定符和类型 | 方法和说明 |
|---|---|
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. number of reduce-tasks for the job.
|
static String |
getPartitionFile(JobConf job)
Get the path to the SequenceFile storing the sorted partition keyset.
|
static void |
setPartitionFile(JobConf job,
Path p)
Set the path to the SequenceFile storing the sorted partition keyset.
|
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 在接口中 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 在接口中 Partitioner<K extends 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, Path p)
Copyright © 2009 The Apache Software Foundation