package whut.onetomany;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Partitioner;
public class PartitionByText extends Partitioner<TextIntPair, Text> {
@Override
public int getPartition(TextIntPair key, Text value, int numPartitions) {
// TODO Auto-generated method stub
return (key.getFirstKey().hashCode()&Integer.MAX_VALUE)%numPartitions;
}
}
相关阅读:
Hadoop权威指南(中文版-带目录索引)PDF
Hadoop权威指南(中文第2版)PDF
采用MapReduce与Hadoop进行大数据分析