org.apache.hadoop.examples.terasort
Class TeraSort.SimplePartitioner

java.lang.Object
  extended by org.apache.hadoop.mapreduce.Partitioner<org.apache.hadoop.io.Text,org.apache.hadoop.io.Text>
      extended by org.apache.hadoop.examples.terasort.TeraSort.SimplePartitioner
All Implemented Interfaces:
org.apache.hadoop.conf.Configurable
Enclosing class:
TeraSort

public static class TeraSort.SimplePartitioner
extends Partitioner<org.apache.hadoop.io.Text,org.apache.hadoop.io.Text>
implements org.apache.hadoop.conf.Configurable

A total order partitioner that assigns keys based on their first PREFIX_LENGTH bytes, assuming a flat distribution.


Constructor Summary
TeraSort.SimplePartitioner()
           
 
Method Summary
 org.apache.hadoop.conf.Configuration getConf()
           
 int getPartition(org.apache.hadoop.io.Text key, org.apache.hadoop.io.Text value, int numPartitions)
          Get the partition number for a given key (hence record) given the total number of partitions i.e.
 void setConf(org.apache.hadoop.conf.Configuration conf)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TeraSort.SimplePartitioner

public TeraSort.SimplePartitioner()
Method Detail

setConf

public void setConf(org.apache.hadoop.conf.Configuration conf)
Specified by:
setConf in interface org.apache.hadoop.conf.Configurable

getConf

public org.apache.hadoop.conf.Configuration getConf()
Specified by:
getConf in interface org.apache.hadoop.conf.Configurable

getPartition

public int getPartition(org.apache.hadoop.io.Text key,
                        org.apache.hadoop.io.Text 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<org.apache.hadoop.io.Text,org.apache.hadoop.io.Text>
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