org.apache.hadoop.mapred.lib
Class HashPartitioner

java.lang.Object
  extended by org.apache.hadoop.mapred.lib.HashPartitioner
All Implemented Interfaces:
JobConfigurable, Partitioner

public class HashPartitioner
extends Object
implements Partitioner

Partition keys by their Object.hashCode().


Constructor Summary
HashPartitioner()
           
 
Method Summary
 void configure(JobConf job)
          Initializes a new instance from a JobConf.
 int getPartition(WritableComparable key, Writable value, int numReduceTasks)
          Use Object.hashCode() to partition.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HashPartitioner

public HashPartitioner()
Method Detail

configure

public void configure(JobConf job)
Description copied from interface: JobConfigurable
Initializes a new instance from a JobConf.

Specified by:
configure in interface JobConfigurable
Parameters:
job - the configuration

getPartition

public int getPartition(WritableComparable key,
                        Writable value,
                        int numReduceTasks)
Use Object.hashCode() to partition.

Specified by:
getPartition in interface Partitioner
Parameters:
key - the entry key
value - the entry value
numReduceTasks - the number of partitions
Returns:
the partition number


Copyright © 2006 The Apache Software Foundation