You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-user@hadoop.apache.org by dealmaker <vi...@gmail.com> on 2009/06/04 01:11:43 UTC

Re: Do I need to implement Readfields and Write Functions If I have Only One Field?

I have the following as my type of my "value" object.  Do I need to implement
readfields and write functions?

  private static class StringArrayWritable extends ArrayWritable { 
    private StringArrayWritable (String [] aSString) { 
      super (aSString); 
    } 
  } 


Aaron Kimball-3 wrote:
> 
> If you can use an existing serializeable type to hold that field (e.g., if
> it's an integer, then use IntWritable) then you can just get away with
> that.
> If you are specifying your own class for a key or value class, then yes,
> the
> class must implement readFields() and write().
> 
> There's no concept of introspection or other "magic" to determine how to
> serialize types by decomposing them into more primitive types - you must
> manually insert the logic for this in every class you use.
> 
> - Aaron
> 
> On Wed, Jun 3, 2009 at 2:41 PM, dealmaker <vi...@gmail.com> wrote:
> 
>>
>> Hi,
>>  I have only one field for the record.  I wonder if I even need to define
>> a
>> member variable in class Record.  Do I even need to implement readfields
>> and
>> write functions if I have only one field?  Can I just use the "value"
>> object
>> directly instead of a member variable of value object?
>> Thanks.
>> --
>> View this message in context:
>> http://www.nabble.com/Do-I-need-to-implement-Readfields-and-Write-Functions-If-I-have-Only-One-Field--tp23860009p23860009.html
>> Sent from the Hadoop core-user mailing list archive at Nabble.com.
>>
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/Do-I-need-to-implement-Readfields-and-Write-Functions-If-I-have-Only-One-Field--tp23860009p23861181.html
Sent from the Hadoop core-user mailing list archive at Nabble.com.


Re: Do I need to implement Readfields and Write Functions If I have Only One Field?

Posted by Aaron Kimball <aa...@cloudera.com>.
If you don't add any member fields, then no, I don't think you need to
change anything.
- Aaron

On Wed, Jun 3, 2009 at 4:11 PM, dealmaker <vi...@gmail.com> wrote:

>
> I have the following as my type of my "value" object.  Do I need to
> implement
> readfields and write functions?
>
>  private static class StringArrayWritable extends ArrayWritable {
>    private StringArrayWritable (String [] aSString) {
>      super (aSString);
>     }
>  }
>
>
> Aaron Kimball-3 wrote:
> >
> > If you can use an existing serializeable type to hold that field (e.g.,
> if
> > it's an integer, then use IntWritable) then you can just get away with
> > that.
> > If you are specifying your own class for a key or value class, then yes,
> > the
> > class must implement readFields() and write().
> >
> > There's no concept of introspection or other "magic" to determine how to
> > serialize types by decomposing them into more primitive types - you must
> > manually insert the logic for this in every class you use.
> >
> > - Aaron
> >
> > On Wed, Jun 3, 2009 at 2:41 PM, dealmaker <vi...@gmail.com> wrote:
> >
> >>
> >> Hi,
> >>  I have only one field for the record.  I wonder if I even need to
> define
> >> a
> >> member variable in class Record.  Do I even need to implement readfields
> >> and
> >> write functions if I have only one field?  Can I just use the "value"
> >> object
> >> directly instead of a member variable of value object?
> >> Thanks.
> >> --
> >> View this message in context:
> >>
> http://www.nabble.com/Do-I-need-to-implement-Readfields-and-Write-Functions-If-I-have-Only-One-Field--tp23860009p23860009.html
> >> Sent from the Hadoop core-user mailing list archive at Nabble.com.
> >>
> >>
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/Do-I-need-to-implement-Readfields-and-Write-Functions-If-I-have-Only-One-Field--tp23860009p23861181.html
> Sent from the Hadoop core-user mailing list archive at Nabble.com.
>
>