public abstract class Partitioner<KEY,VALUE> extends Object
Partitioner
controls the partitioning of the keys of the
intermediate map-outputs. The key (or a subset of the key) is used to derive
the partition, typically by a hash function. The total number of partitions
is the same as the number of reduce tasks for the job. Hence this controls
which of the m
reduce tasks the intermediate key (and hence the
record) is sent for reduction.
Reducer
构造器和说明 |
---|
Partitioner() |
限定符和类型 | 方法和说明 |
---|---|
abstract int |
getPartition(KEY key,
VALUE value,
int numPartitions)
Get the partition number for a given key (hence record) given the total
number of partitions i.e. number of reduce-tasks for the job.
|
public abstract int getPartition(KEY key, VALUE value, int numPartitions)
Typically a hash function on a all or a subset of the key.
key
- the key to be partioned.value
- the entry value.numPartitions
- the total number of partitions.key
.Copyright © 2009 The Apache Software Foundation