hadoop-common-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Simon Gilliot (Commented) (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HADOOP-8272) BytesWritable length problem
Date Mon, 16 Apr 2012 13:04:23 GMT

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

Simon Gilliot commented on HADOOP-8272:

My bad, you're right.
I read all the source code of BytesWritable to understand what's happening and miss the getBytes()

Sorry for that
> BytesWritable length problem
> ----------------------------
>                 Key: HADOOP-8272
>                 URL: https://issues.apache.org/jira/browse/HADOOP-8272
>             Project: Hadoop Common
>          Issue Type: Bug
>          Components: io
>    Affects Versions:
>            Reporter: Simon Gilliot
>              Labels: hadoop
>   Original Estimate: 1h
>  Remaining Estimate: 1h
> I tried to create my own Writable which contains a BytesWritable.
> In my conctructor, I tried to create an empty BytesWritable :
> BytesWritable key = new BytesWritable();
> Next, in my readFields, I did :
> key.readFields(in); LOG.debug(Bytes.toString(key.getBytes()));
> The key contains much more bytes than I had wrote.
> In fact, if my BytesWritable contains 100 bytes, I thing that the readFields() of BytesWritable
call :
> * setSize(0) (which seems useless since the values in the old range are preserved and
any new values are undefined). * setSize(100) which extends the bytes array (by setCapacity)
to 1.5 * the size (so 150) without initalizing it
> * readFully(bytes, 0, 100) which fill the bytes array from '0' to '100' offsets.
> And when I call getBytes() on it, the bytes array of 150 bytes is returned without any
> That seems possible that the same problem happens in other conditions, when we increase
ths bytes array size.

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira


View raw message