[
https://issues.apache.org/jira/browse/PHOENIX-2845?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15261356#comment-15261356
]
James Taylor commented on PHOENIX-2845:
---------------------------------------
Thanks for the patch, [~sergey.soldatov]. Don't we only need to do the
Integer.parseInt() if the # of digits is > 3 in DateUtil.parseTimestamp? What
does Joda time do in this case? Does it ignore the millisecond part? Is it a
correct assumption to treat something like this: {{1970-01-01 00:00:10.1234}}
as 123 milliseconds and 400000 nanoseconds (and am I interpreting the code
correctly)? Not sure what the standard is here for nanoseconds.
Also, it'd be good to have a test in DateUtilTest that tests a nano value with
less than 9 digits, like this:
{code}
+ @Test
+ public void testParseTimestamp_WithNanos() {
+ assertEquals(1234567, DateUtil.parseTimestamp("1970-01-01
00:00:10.123456700").getNanos
+ ());
+ assertEquals(123, DateUtil.parseTimestamp("1970-01-01
00:00:10.123456700").getTime
+ ());
+ }
{code}
> Timestamp ignores nanos in literal expressions
> ----------------------------------------------
>
> Key: PHOENIX-2845
> URL: https://issues.apache.org/jira/browse/PHOENIX-2845
> Project: Phoenix
> Issue Type: Bug
> Affects Versions: 4.7.0
> Reporter: Sergey Soldatov
> Assignee: Sergey Soldatov
> Attachments: PHOENIX-2845-1.patch, PHOENIX-2845-2.patch
>
>
> Phoenix strips nanos in Timestamp. Simple test case:
> {noformat}
> create table x (id bigint primary key, t timestamp);
> upsert into x values (1, TIMESTAMP'2015-01-01 00:00:00.123456');
> upsert into x values (2, TIMESTAMP'2015-01-01 00:00:00.123457');
> upsert into x values (3, TIMESTAMP'2015-01-01 00:00:00.123999');
> {noformat}
> HBase scan:
> {noformat}
> 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\x02 column=0:T, timestamp=1460646673369,
> value=\x80\x00\x01J\xA2\xCA\xB0{\x00\x00\x00\x00
> \x80\x00\x00\x00\x00\x00\x00\x03 column=0:T, timestamp=1460646680294,
> value=\x80\x00\x01J\xA2\xCA\xB0{\x00\x00\x00\x00
> {noformat}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)