org.apache.nutch.mapReduce.lib
Class HashPartitioner
java.lang.Object
org.apache.nutch.mapReduce.lib.HashPartitioner
- All Implemented Interfaces:
- Configurable, Partitioner
- public class HashPartitioner
- extends Object
- implements Partitioner
Partition keys by their Object.hashCode().
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
HashPartitioner
public HashPartitioner()
configure
public void configure(JobConf job)
- Description copied from interface:
Configurable
- Initializes a new instance from a
JobConf.
- Specified by:
configure in interface Configurable
- Parameters:
job - the configuration
getPartition
public int getPartition(WritableComparable key,
int numReduceTasks)
- Use
Object.hashCode() to partition.
- Specified by:
getPartition in interface Partitioner
- Parameters:
key - the keynumReduceTasks - the number of partitions
- Returns:
- the partition number
Copyright © 2006 The Apache Software Foundation