Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Threaded View
HBase >> mail # user >> question about hbase rest api decoding long value stored as byte array


Copy link to this message
-
Re: question about hbase rest api decoding long value stored as byte array
Hi Weishung,

Since you stored the value as a long rather than String. You need to
convert the byte [] of value into a Long. You can use the  following method
to convert byte[] into long.
long org.apache.hadoop.hbase.util.Bytes<eclipse-javadoc:%E2%98%82=hbase_resteasy/C:%5C/Users%5C/agupta5%5C/.m2%5C/repository%5C/org%5C/apache%5C/hbase%5C/hbase%5C/0.92.1-cdh4.0.1%5C/hbase-0.92.1-cdh4.0.1.jar%3Corg.apache.hadoop.hbase.util(Bytes.class%E2%98%83Bytes>
.toLong(byte[] bytes)

HTH,
Anil Gupta

On Wed, Oct 3, 2012 at 10:42 PM, Weishung Chung <[EMAIL PROTECTED]> wrote:

> Hi,
>
> I store a long value as byte array in HBase cell using an Increment object.
>
> When I try to access the value via javascript using rest api, how do I
> decode the value ? It works fine for String value when using atob method
> but somehow I couldn't decode the long value correctly :(
>
> Thank you,
> Wei Shung
>

--
Thanks & Regards,
Anil Gupta