You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@phoenix.apache.org by Sergey Soldatov <se...@gmail.com> on 2016/04/14 01:15:50 UTC

Timestamp with nanos.

Guys,
Is there a way to set nanos for Timestamp from sql statement? The only
way to set nanos I see at the moment is to use PrepareStatement
together with java.sun.Timestamp#setNanos() in Java. Did I miss
something?

Thanks,
Sergey

Re: Timestamp with nanos.

Posted by Sergey Soldatov <se...@gmail.com>.
Nope. It will just skip nanos:

0: jdbc:phoenix:localhost> upsert into x values (1, TIMESTAMP
'2015-01-01 00:00:00.123456');
1 row affected (0.005 seconds)
0: jdbc:phoenix:localhost> upsert into x values (2, TIMESTAMP
'2015-01-01 00:00:00.123457');
1 row affected (0.004 seconds)
0: jdbc:phoenix:localhost> upsert into x values (3, TIMESTAMP
'2015-01-01 00:00:00.123999');
1 row affected (0.005 seconds)

hbase(main):007:0> scan 'X'
ROW
COLUMN+CELL
 \x80\x00\x00\x00\x00\x00\x00\x01
column=0:T, timestamp=1460646668779,
value=\x80\x00\x01J\xA2\xCA\xB0{\x00\x00\x00\x00
 \x80\x00\x00\x00\x00\x00\x00\x01
column=0:_0, timestamp=1460646668779, value=x
 \x80\x00\x00\x00\x00\x00\x00\x02
column=0:T, timestamp=1460646673369,
value=\x80\x00\x01J\xA2\xCA\xB0{\x00\x00\x00\x00
 \x80\x00\x00\x00\x00\x00\x00\x02
column=0:_0, timestamp=1460646673369, value=x
 \x80\x00\x00\x00\x00\x00\x00\x03
column=0:T, timestamp=1460646680294,
value=\x80\x00\x01J\xA2\xCA\xB0{\x00\x00\x00\x00
 \x80\x00\x00\x00\x00\x00\x00\x03
column=0:_0, timestamp=1460646680294, value=x



On Wed, Apr 13, 2016 at 6:03 PM, Nick Dimiduk <nd...@gmail.com> wrote:
> Can you not use syntax like TIMESTAMP '2016-01-01 00:00:00.123456789' for
> the sql value?
>
> On Wed, Apr 13, 2016 at 4:15 PM, Sergey Soldatov <se...@gmail.com>
> wrote:
>
>> Guys,
>> Is there a way to set nanos for Timestamp from sql statement? The only
>> way to set nanos I see at the moment is to use PrepareStatement
>> together with java.sun.Timestamp#setNanos() in Java. Did I miss
>> something?
>>
>> Thanks,
>> Sergey
>>

Re: Timestamp with nanos.

Posted by Nick Dimiduk <nd...@gmail.com>.
Can you not use syntax like TIMESTAMP '2016-01-01 00:00:00.123456789' for
the sql value?

On Wed, Apr 13, 2016 at 4:15 PM, Sergey Soldatov <se...@gmail.com>
wrote:

> Guys,
> Is there a way to set nanos for Timestamp from sql statement? The only
> way to set nanos I see at the moment is to use PrepareStatement
> together with java.sun.Timestamp#setNanos() in Java. Did I miss
> something?
>
> Thanks,
> Sergey
>