phoenix-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From James Taylor <jamestay...@apache.org>
Subject Re: Parsing TIMESTAMP value as HBase bytes
Date Mon, 21 Dec 2015 20:29:01 GMT
Use UNSIGNED_TIMESTAMP instead.

On Mon, Dec 21, 2015 at 12:17 PM, Naor David <tron47@gmail.com> wrote:

> Hello,
> I'm using Phoenix 4.3.0 in CDH5.4 cluster.
> I'm trying to parse a TIMESTAMP column from a table using HBase native
> API. (Because I want to get all versions of that column, which I
> couldn't do using Phoenix JDBC)
>
> From the documentation, the TIMESTAMP type is a 12-byte value, 8-byte
> for the milliseconds since the epoch, and 4 bytes for the nanoseconds.
> My HBase query resulted in a Java byte[] array (which has 12 bytes indeed)
>
> from there, I tried parsing the first 8 bytes into a long variable,
> and then parsing that long value to a java.sql.Timestamp object.
> (let's ignore the 4-bytes for now)
> the problem is that the resulting long value is a large Negative
> number, which make no sense for a timestamp value.
>
> Is there a correct method for extracting this long value?
>
> Thanks,
>
> David
>

Mime
View raw message