You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@drill.apache.org by "Pavel Semenov (JIRA)" <ji...@apache.org> on 2019/06/13 11:25:00 UTC

[jira] [Comment Edited] (DRILL-7139) Date_add() can produce incorrect results when adding to a timestamp

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

Pavel Semenov edited comment on DRILL-7139 at 6/13/19 11:24 AM:
----------------------------------------------------------------

Now it is possible to create time stamp with appropriate sequence
{code:java}
select date_add(timestamp '1970-01-01 00:00:00', cast(concat('PT',107374,'M') as interval minute)) timestamp_id from (values(1));
+-----------------------+
| timestamp_id          |  
+-----------------------+
| 1970-03-16 13:34:00.0 |
+-----------------------+

select date_add(timestamp '1970-01-01 00:00:00', cast(concat('PT',107375,'M') as interval minute)) timestamp_id from (values(1));
+-----------------------+
| timestamp_id          |
+-----------------------+
| 1970-03-16 13:35:00.0 |
+-----------------------+

{code}
Fixed


was (Author: pavel.semenov):
Now it is possible to create time stamp with appropriate sequence 
{code}select date_add(timestamp '1970-01-01 00:00:00', cast(concat('PT',107374,'M') as interval minute)) timestamp_id from (values(1));
+-----------------------+
| timestamp_id       |
+-----------------------+
| 1970-03-16 13:34:00.0 |
+-----------------------+

select date_add(timestamp '1970-01-01 00:00:00', cast(concat('PT',107375,'M') as interval minute)) timestamp_id from (values(1));
+-----------------------+
| timestamp_id       |
+-----------------------+
| 1970-03-16 13:35:00.0 |
+-----------------------+

{code}

Fixed

> Date_add() can produce incorrect results when adding to a timestamp
> -------------------------------------------------------------------
>
>                 Key: DRILL-7139
>                 URL: https://issues.apache.org/jira/browse/DRILL-7139
>             Project: Apache Drill
>          Issue Type: Bug
>          Components: Functions - Drill
>    Affects Versions: 1.15.0
>            Reporter: Robert Hou
>            Assignee: Dmytriy Grinchenko
>            Priority: Major
>             Fix For: 1.17.0
>
>
> I am using date_add() to create a sequence of timestamps:
> {noformat}
> select date_add(timestamp '1970-01-01 00:00:00', cast(concat('PT',107374,'M') as interval minute)) timestamp_id from (values(1));
> +--------------------------+
> |       timestamp_id       |
> +--------------------------+
> | 1970-01-25 20:31:12.704  |
> +--------------------------+
> 1 row selected (0.121 seconds)
> {noformat}
> When I add one more, I get an older timestamp:
> {noformat}
> select date_add(timestamp '1970-01-01 00:00:00', cast(concat('PT',107375,'M') as interval minute)) timestamp_id from (values(1));
> +--------------------------+
> |       timestamp_id       |
> +--------------------------+
> | 1969-12-07 03:29:25.408  |
> +--------------------------+
> 1 row selected (0.126 seconds)
> {noformat}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)