hadoop-common-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Aaron T. Myers (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HADOOP-310) Additional constructor requested in BytesWritable
Date Wed, 22 Jun 2011 17:12:47 GMT

    [ https://issues.apache.org/jira/browse/HADOOP-310?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13053344#comment-13053344

Aaron T. Myers commented on HADOOP-310:

Hey Brock, thanks a lot for reviving this issue (after 5 years!) I have a few small concerns
about this patch:

# The constructor which only takes a {{byte[]}} can now be implemented in terms of this new
constructor you've introduced.
# We now have {{set(byte[] bytes, int length)}} and {{set(byte[] bytes, int offset, int length)}},
which differ not only in signature, but in their semantics with respect to copying of the
input data. This seems like it might lead to confusion. Perhaps we should name the new method
something like {{setDirect(...)}}? Or perhaps we should amend the existing {{set(...)}} method
to not do a copy? The latter is obviously a trickier and backward-incompatible change,  but
probably clearer.

> Additional constructor requested in BytesWritable
> -------------------------------------------------
>                 Key: HADOOP-310
>                 URL: https://issues.apache.org/jira/browse/HADOOP-310
>             Project: Hadoop Common
>          Issue Type: Improvement
>          Components: io
>            Reporter: p sutter
>            Assignee: Owen O'Malley
>            Priority: Minor
>         Attachments: bytes-writable-zero-copy-interface-0.patch, bytes-writable-zero-copy-interface-1.patch
> It would be grand if BytesWritable.java had an additional constructor as below. This
allows me to use the BytesWritable class without doing a buffer copy, since we have a less-than-fully-utilized
byte array holding our key.
> Thanks!
>  /**
>    * Create a BytesWritable using the byte array as the initial value.
>    * @param bytes This array becomes the backing storage for the object.
>    */
>   public BytesWritable(byte[] bytes, int size) {
>     this.bytes = bytes;
>     this.size = size;
>   }

This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira


View raw message