You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@phoenix.apache.org by Bill Q <bi...@gmail.com> on 2014/11/22 22:06:50 UTC
Double value displayed wrong through Phoenix
Hi,
I just started using Phoenix. I use HBase 0.98.3 Java API to put some
double numbers in the table. But the value displayed through Squirrel and
Phoenix are different from what I put in.
If I use HBase Java API to get the value from those inserted rows, the
double values are correct. So, it seems to be a display issue with Squirrel
and Phoenix. For example, all the negative number has displayed as positive
number or really small negative number like -0.0005, etc.
I used DOUBLE as the column type when I created the table in Phoenix. And
used HBase Java API Bytes.toByte(double) in the Put to insert the row.
Any suggestions?
Many thanks.
Bill
Re: Double value displayed wrong through Phoenix
Posted by Fenny Thomas <ft...@interset.com>.
As you're serializing using hbase's Bytes.toBytes(double), map your
column type as UNSIGNED_DOUBLE. Details here -
http://phoenix.apache.org/language/datatypes.htm
Alternatively as Anil suggested, use phoenix's api (jdbc) or serialize
using PDataType something like PDataType.DOUBLE.toBytes(double)
- Fenny Thomas
On 14-11-22 06:58 PM, Anil Gupta wrote:
> While writing data into HBase I would recommend you to use either Phoenix api or use PDataType class of Phoenix. Phoenix serialization/deserialization is different from Bytes class.
>
> Hope this helps,
> Anil
>
> Sent from my iPhone
>
>> On Nov 22, 2014, at 1:06 PM, Bill Q <bi...@gmail.com> wrote:
>>
>> Hi,
>> I just started using Phoenix. I use HBase 0.98.3 Java API to put some double numbers in the table. But the value displayed through Squirrel and Phoenix are different from what I put in.
>>
>> If I use HBase Java API to get the value from those inserted rows, the double values are correct. So, it seems to be a display issue with Squirrel and Phoenix. For example, all the negative number has displayed as positive number or really small negative number like -0.0005, etc.
>>
>> I used DOUBLE as the column type when I created the table in Phoenix. And used HBase Java API Bytes.toByte(double) in the Put to insert the row.
>>
>> Any suggestions?
>>
>>
>>
>> Many thanks.
>>
>>
>> Bill
Re: Double value displayed wrong through Phoenix
Posted by Anil Gupta <an...@gmail.com>.
While writing data into HBase I would recommend you to use either Phoenix api or use PDataType class of Phoenix. Phoenix serialization/deserialization is different from Bytes class.
Hope this helps,
Anil
Sent from my iPhone
> On Nov 22, 2014, at 1:06 PM, Bill Q <bi...@gmail.com> wrote:
>
> Hi,
> I just started using Phoenix. I use HBase 0.98.3 Java API to put some double numbers in the table. But the value displayed through Squirrel and Phoenix are different from what I put in.
>
> If I use HBase Java API to get the value from those inserted rows, the double values are correct. So, it seems to be a display issue with Squirrel and Phoenix. For example, all the negative number has displayed as positive number or really small negative number like -0.0005, etc.
>
> I used DOUBLE as the column type when I created the table in Phoenix. And used HBase Java API Bytes.toByte(double) in the Put to insert the row.
>
> Any suggestions?
>
>
>
> Many thanks.
>
>
> Bill