利用Mapreduece做中位数和标准差
先定义一个自定义的值类型,实现Writable接口
然后去存储数据
话不多说 附上代码:
package com.standard1;
import org.apache.hadoop.io.Writable;
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
public class IntPair implements Writable {
private float ave = 0;
private float deviation = 0;
public void IntPair(){
}
public void IntPair(float ave,float deviation){
this.ave = ave;
this.deviation = deviation;
}
public float getAve() {
return ave;
}
public float getDeviation() {
return deviation;
}
public void setAve(float ave) {
this.ave = ave;
}
public void setDeviation(float deviation) {
this.deviation = deviation;
}
public void write(DataOutput out)throws IOException {
out.writeFloat(ave);
out.writeFloat(deviation);
}
public void readFields(DataInput in)t