phoenix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ramkrishna.s.vasudevan (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (PHOENIX-2475) Date arithmetic broken for time and timestamp
Date Thu, 24 Dec 2015 09:12:49 GMT

    [ https://issues.apache.org/jira/browse/PHOENIX-2475?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15070784#comment-15070784
] 

ramkrishna.s.vasudevan commented on PHOENIX-2475:
-------------------------------------------------

bq.Would you mind adding tests for TIME type too, please?
What is the expectation when we do a +1 on the TIME?  Does it increase the specified time
by one sec?
Because I don't see that happening. For DATE it happens but not for TIME datatype.
{code}
 conn = DriverManager.getConnection(getUrl(), props);
      stmt = conn.prepareStatement("upsert into time_table values (?)");
      stmt.setTime(1, new Time(4, 2, 1));
......
.....
      rs = conn.createStatement().executeQuery("SELECT ts FROM time_table");
      assertTrue(rs.next());
      assertEquals("04:02:01",rs.getTime(1).toString());
{code}
But after we do some addition to the time like
{code}
     rs = conn.createStatement().executeQuery("SELECT ts + 1 FROM time_table");
{code}
The result still remain 04:02:01  and not 04:02:02. Is this expected?


> Date arithmetic broken for time and timestamp
> ---------------------------------------------
>
>                 Key: PHOENIX-2475
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-2475
>             Project: Phoenix
>          Issue Type: New Feature
>    Affects Versions: 4.6.0
>            Reporter: Kevin Liew
>            Assignee: ramkrishna.s.vasudevan
>            Priority: Minor
>              Labels: date, newbie, phoenix, timestamp
>             Fix For: 4.7.0
>
>         Attachments: PHOENIX-2475_master.patch
>
>
> Create a timestamp table and insert a timestamp
> {noformat}create table timestamp_table (ts timestamp primary key)upsert into timestamp_table
values ('1995-05-02 01:01:01'){noformat}
> Example test case
> {noformat}select ts + 1 from timestamp_table{noformat}
> Expected result:
> The timestamp with one day added to it
> {noformat}1995-05-03 01:01:01{noformat}
> Actual result:
> the unmodified timestamp



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message