當我做一個mapreduce程序,我遇到的關鍵是一個元組(A,B)(A和B都是整數集)。我怎樣才能定製這種數據類型?mapreduce ---自定義數據類型
public static class MapClass extends Mapper<Object,Text,Tuple,Tuple>....
public class Tuple implements WritableComparable<Tuple>{
@Override
public void readFields(DataInput arg0) throws IOException {
// TODO Auto-generated method stub
}
@Override
public void write(DataOutput arg0) throws IOException {
// TODO Auto-generated method stub
}
@Override
public int compareTo(Tuple o) {
// TODO Auto-generated method stub
return 0;
}
}
看看這個:http://hadoop-blog.blogspot.in/2012/04/hadoop-example-using-custom-java-class.html – Amar 2013-03-23 08:37:16
感謝您分享鏈接給我,但數據類型我要實現的不是String對.A是Integer集合。例如,A = {0,1,2,3}。 – user2178911 2013-03-23 13:01:18