hadoop-common-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ted Yu <yuzhih...@gmail.com>
Subject Re: User defined class as Map/Reduce output value
Date Tue, 27 Apr 2010 18:19:35 GMT
Take a look at the sample given in Javadoc of Writable.java
You need to serialize your data yourself:
     @Override
    public void readFields(DataInput in) throws IOException {
      h = Text.readString(in);
      sc = in.readFloat();
      ran = in.readInt ();
    }


On Tue, Apr 27, 2010 at 10:53 AM, Farhan Husain
<farhan.husain@csebuet.org>wrote:

> Hello,
>
> I want to output a class which I have written as the value of the map
> phase.
> The obvious was is to implement the Writable interface but the problem is
> the class has other classes as its member properties. The DataInput and
> DataOutput interfaces used by the read and write methods of the Writable
> class do not support object serialization. Is there any other way I can
> achieve this?
>
> Thanks,
> Farhan
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message