您可以编写自定义类型,将其作为映射器值发出。但是无论您要发出什么值,都必须实现可写接口。您可以执行以下操作:
public class MyObj implements WritableComparable<MyObj>{ private String date; private Double balance; public String getDate() { return date;} public Double getBalance() { return balance;} @Override public void readFields(DataInput in) throws IOException { //Define how you want to read the fields } @Override public void writeFields(DataOutput out) throws IOException { //Define how you want to write the fields } ....... ....... .......}另外,您可以使用Avro序列化框架。



