phoenix-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gabriel Reid <gabriel.r...@gmail.com>
Subject Re: Numbers low-level format in Phoenix
Date Thu, 08 Jan 2015 11:09:14 GMT
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