You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-dev@hadoop.apache.org by "paul sutter (JIRA)" <ji...@apache.org> on 2006/06/20 20:13:29 UTC
[jira] Created: (HADOOP-310) Additional constructor requested in
BytesWritable
Additional constructor requested in BytesWritable
-------------------------------------------------
Key: HADOOP-310
URL: http://issues.apache.org/jira/browse/HADOOP-310
Project: Hadoop
Type: Improvement
Components: io
Reporter: paul sutter
Priority: Minor
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.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
[jira] Commented: (HADOOP-310) Additional constructor requested in
BytesWritable
Posted by "paul sutter (JIRA)" <ji...@apache.org>.
[ http://issues.apache.org/jira/browse/HADOOP-310?page=comments#action_12417176 ]
paul sutter commented on HADOOP-310:
------------------------------------
That would be even better... but would require a rewrite and retest of the rest of the class (the class already supports a length, but not an offset).
> Additional constructor requested in BytesWritable
> -------------------------------------------------
>
> Key: HADOOP-310
> URL: http://issues.apache.org/jira/browse/HADOOP-310
> Project: Hadoop
> Type: Improvement
> Components: io
> Reporter: paul sutter
> Priority: Minor
>
> 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.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
[jira] Commented: (HADOOP-310) Additional constructor requested in
BytesWritable
Posted by "Owen O'Malley (JIRA)" <ji...@apache.org>.
[ http://issues.apache.org/jira/browse/HADOOP-310?page=comments#action_12417177 ]
Owen O'Malley commented on HADOOP-310:
--------------------------------------
I'm ok with either change. Obviously introducing an offset is a bigger change. Clearly if the BytesWritable needs to grow, the offset should go to 0. Equivalently, the offset should not be saved as part of the serialization.
> Additional constructor requested in BytesWritable
> -------------------------------------------------
>
> Key: HADOOP-310
> URL: http://issues.apache.org/jira/browse/HADOOP-310
> Project: Hadoop
> Type: Improvement
> Components: io
> Reporter: paul sutter
> Priority: Minor
>
> 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.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
[jira] Commented: (HADOOP-310) Additional constructor requested in
BytesWritable
Posted by "Andrzej Bialecki (JIRA)" <ji...@apache.org>.
[ http://issues.apache.org/jira/browse/HADOOP-310?page=comments#action_12417172 ]
Andrzej Bialecki commented on HADOOP-310:
------------------------------------------
Perhaps a more general constructor, similar to the ones used in many other places, would be better:
/**
* Create a BytesWritable using a part of the byte array as the initial value.
*/
public BytesWritable(byte[] bytes, int offset, int length) {
....
}
This way it would satisfy your requirement, and perhaps help to avoid many other cases of copying ...
> Additional constructor requested in BytesWritable
> -------------------------------------------------
>
> Key: HADOOP-310
> URL: http://issues.apache.org/jira/browse/HADOOP-310
> Project: Hadoop
> Type: Improvement
> Components: io
> Reporter: paul sutter
> Priority: Minor
>
> 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.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira