hadoop-common-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nathan Marz (JIRA)" <j...@apache.org>
Subject [jira] Commented: (HADOOP-6298) BytesWritable#getBytes is a bad name that leads to programming mistakes
Date Fri, 09 Oct 2009 05:00:31 GMT

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

Nathan Marz commented on HADOOP-6298:
-------------------------------------

Yes - I'm proposing solely a rename, not an API change. The behavior of the method is exactly
as it should be for performance reasons. I'm ok with leaving out "getNonPaddedValue" and leaving
it up to the user to do the copy if they need it - this idea was just for programmer convenience
but I can see how it could be accidentally misused. 

I understand that it's clearly documented - the problem is, no one looks at the JavaDoc for
these seemingly "obvious" methods. Can we at least agree that the name is confusing? Myself
and all my coworkers who have worked with Hadoop have made this mistake.


> BytesWritable#getBytes is a bad name that leads to programming mistakes
> -----------------------------------------------------------------------
>
>                 Key: HADOOP-6298
>                 URL: https://issues.apache.org/jira/browse/HADOOP-6298
>             Project: Hadoop Common
>          Issue Type: Improvement
>    Affects Versions: 0.20.1
>            Reporter: Nathan Marz
>
> Pretty much everyone at Rapleaf who has worked with Hadoop has misused BytesWritable#getBytes
at some point, not expecting the byte array to be padded. I think we can completely alleviate
these programming mistakes by deprecating and renaming this method (again) to be more descriptive.
I propose "getPaddedBytes()" or "getPaddedValue()". It would also be helpful to have a helper
method "getNonPaddedValue()" that makes a copy into a non-padded byte array. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message