hbase-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Barney Frank <barneyfran...@gmail.com>
Subject Re: Converting Double value received via Stargate
Date Fri, 24 Dec 2010 16:26:01 GMT
Have you tried extracting values using Bytes.toDouble(value) or
Bytes.toLong(value)?

On Fri, Dec 24, 2010 at 9:20 AM, Subhash Bhushan <
subhash.bhushan@stratalabs.in> wrote:

> Hi,
>
> I am using a Ruby on Rails client to extract values from HBase via
> Stargate.
>
>
> --------------------------------------------------------------------------------------------------------
> "price" field has been defined as follows:
> private Double price;
>
> --------------------------------------------------------------------------------------------------------
> I have inserted values into HBase like this:
> p.add(
> Bytes.toBytes("detail"),
> Bytes.toBytes("price"),
> timeStamp,
> Bytes.toBytes(item.getPrice()));
>
> --------------------------------------------------------------------------------------------------------
> When I extract value of price via Stargate, i get the following value:
> value=@\x91,\x00\x00\x00\x00\x00
>
> --------------------------------------------------------------------------------------------------------
>
> How do I convert this into proper Double value in Ruby?
> Or should I always store fields as String? The same applies to my Long
> variables too.
>
> Regards,
> Subhash Bhushan.
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message