phoenix-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Lavrenty Eskin <lavrenty.es...@NetCracker.com>
Subject RE: Numbers low-level format in Phoenix
Date Thu, 08 Jan 2015 11:44:30 GMT
Hi Gabriel,

But why then I receive in HBase shell two different string representation of the byte array?
For byte arrays stored from phoenix - \x00\x00\x00\x00I\x96\x02\xD2 and [B@13217cf6 for stored
from HBase.
The same time phoenix have wrong understanding of "[B@13217cf6" and receives -323837278362736236786-like
value instead 1234567890
I have to understand the way to store values via hbase API but read from phoenix then correctly.

Thanks

-----Original Message-----
From: Gabriel Reid [mailto:gabriel.reid@gmail.com]
Sent: Thursday, January 08, 2015 2:09 PM
To: user@phoenix.apache.org
Subject: Re: Numbers low-level format in Phoenix

Hi Lavrenty,

Phoenix actually does store numerical data using byte arrays, in a similar fashion to what
the HBase bytes class does. There's more information on the various types and their underlying
encoding available here: http://phoenix.apache.org/language/datatypes.html

I'm guessing you got the string representation
("\x00\x00\x00\x00I\x96\x02\xD2") from the HBase shell -- this is a string representation
of the byte array (containing 8 bytes) containing the serialized value of 1234567890. The
strings you posted like "[B@13217cf6" are the default string representation of byte arrays
in java. To convert these to a human-readable value (like what the HBase shell does), you
could do the following:

    Bytes.toStringBinary(Bytes.toBytes(1234567890L));

- Gabriel

On Thu, Jan 8, 2015 at 9:44 AM, Lavrenty Eskin <lavrenty.eskin@netcracker.com> wrote:
> Helo all,
> I'm surprised that phoenix store numbers not in HBase 'Byte' format. Looks like a big
overhead there, isn't it?
> Just takes 1234567890 value (0х499602D2):
> Phoenix stores that as string '\x00\x00\x00\x00I\x96\x02\xD2'
> But why it cannot store as in HBase format value=[B@499602d2 ?
>
> Another issue is why it write wrong bytes if you write from HBase shell? :
> Bytes.toBytes(1234567890)       -->>    value=[B@13217cf6,
> Bytes.toBytes(1234567890L)      -->>    value=[B@3caab4f


________________________________
The information transmitted herein is intended only for the person or entity to which it is
addressed and may contain confidential, proprietary and/or privileged material. Any review,
retransmission, dissemination or other use of, or taking of any action in reliance upon, this
information by persons or entities other than the intended recipient is prohibited. If you
received this in error, please contact the sender and delete the material from any computer.
Mime
View raw message