FAQ
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.

Search Discussions

  • Aaron Kimball at Jun 3, 2009 at 11:04 pm
    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 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.
  • Dealmaker at Jun 3, 2009 at 11:12 pm
    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 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.
  • Aaron Kimball at Jun 4, 2009 at 8:16 am
    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 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 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.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupcommon-user @
categorieshadoop
postedJun 3, '09 at 9:41p
activeJun 4, '09 at 8:16a
posts4
users2
websitehadoop.apache.org...
irc#hadoop

2 users in discussion

Aaron Kimball: 2 posts Dealmaker: 2 posts

People

Translate

site design / logo © 2022 Grokbase