|
|
-
Constructing A Mutation From Byte Array
David Medinets 2012-11-12, 21:28
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.
+
David Medinets 2012-11-12, 21:28
-
Re: Constructing A Mutation From Byte Array
Josh Elser 2012-11-12, 22:18
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. >
+
Josh Elser 2012-11-12, 22:18
|
|
All projects made searchable here are trademarks of the Apache Software Foundation.
Service operated by
Sematext