You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@accumulo.apache.org by David Medinets <da...@gmail.com> on 2012/11/12 22:28:42 UTC

Constructing A Mutation From Byte Array

I was playing around with reversing the order of my keys in Accumulo
(yes, from the May conversation). After manipulating my key, I had a
byte array and I needed to create a mutation. But there is no
constructor for Mutation that accepts a byte array? I had to wrap my
byte array with a Text object (not very efficient). Is there any
reason why I should not add a new constructor? Doing so seems
straightforward and easy.

Re: Constructing A Mutation From Byte Array

Posted by Josh Elser <jo...@gmail.com>.
Given that Mutation is going to do an arrayCopy of the Text object you 
pass in, I wouldn't be too worried about the overhead of creating a Text 
object from a pre-existing byte[]; however, I see no reason not to make 
a Mutation(byte[]) constructor. Good call.

For completeness, it would probably be smart to add a Mutation(byte[] 
arr, int start, int end) constructor as well and have your 
Mutation(byte[] arr) constructor call Mutation(arr, 0, arr.length).

On 11/12/2012 4:28 PM, David Medinets wrote:
> I was playing around with reversing the order of my keys in Accumulo
> (yes, from the May conversation). After manipulating my key, I had a
> byte array and I needed to create a mutation. But there is no
> constructor for Mutation that accepts a byte array? I had to wrap my
> byte array with a Text object (not very efficient). Is there any
> reason why I should not add a new constructor? Doing so seems
> straightforward and easy.
>