You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@phoenix.apache.org by Cheyenne Forbes <ch...@gmail.com> on 2017/03/17 09:21:16 UTC

Re: Differences between the date/time types

Anyone?

Re: Differences between the date/time types

Posted by James Taylor <ja...@apache.org>.
The DATE and TIME types in Phoenix are more or less the same. They store
their data as an 8 byte long Epoch time and maintain millisecond
granularity.

The TIMESTAMP stores nanosecond data in a 12 bytes - an 8 byte long Epoch
time plus 4 bytes for nanoseconds. Unless you need nanosecond granularity,
I'd stick to using DATE.

Not sure what you mean by "parse". You should use JDBC APIs to access the
data which will return to you a sql Date or sql Time instance. Apart from
that, we have no public APIs to work with these (but you're welcome to look
at the type code in PDate, PTime, and PTimestamp).

The UNSIGNED date types are the same as above, except they use the HBase
Bytes utility methods to serialize/deserialize the 8 byte part of the
date/time. This means you can only store dates greater than 1-1-1970 while
our the other date types allow the value to be negative as well.

HTH. Thanks,

    James

On Fri, Mar 17, 2017 at 2:21 AM, Cheyenne Forbes <
cheyenne.osanu.forbes@gmail.com> wrote:

> Anyone?
>