org.apache.hadoop.examples
Class SecondarySort.FirstPartitioner

java.lang.Object
  extended by org.apache.hadoop.mapreduce.Partitioner<SecondarySort.IntPair,IntWritable>
      extended by org.apache.hadoop.examples.SecondarySort.FirstPartitioner
Enclosing class:
SecondarySort

public static class SecondarySort.FirstPartitioner
extends Partitioner<SecondarySort.IntPair,IntWritable>

Partition based on the first part of the pair.


Constructor Summary
SecondarySort.FirstPartitioner()
           
 
Method Summary
 int getPartition(SecondarySort.IntPair key, IntWritable value, int numPartitions)
          Get the partition number for a given key (hence record) given the total number of partitions i.e.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SecondarySort.FirstPartitioner

public SecondarySort.FirstPartitioner()
Method Detail

getPartition

public int getPartition(SecondarySort.IntPair key,
                        IntWritable value,
                        int numPartitions)
Description copied from class: Partitioner
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.

Typically a hash function on a all or a subset of the key.

Specified by:
getPartition in class Partitioner<SecondarySort.IntPair,IntWritable>
Parameters:
key - the key to be partioned.
value - the entry value.
numPartitions - the total number of partitions.
Returns:
the partition number for the key.


Copyright © 2009 The Apache Software Foundation