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

hyoungjunkim commented on TAJO-761:
-----------------------------------

I attached first patch.
We can use next query
{noformat}
default> select date '2001-09-28' + 7;
result: 1 rows (5 B)
?plus
-------------------------------
2001-10-05

default> select date '2001-09-28' + interval '1 hour';
result: 1 rows (9 B)
?plus
-------------------------------
2001-09-28 01:00:00

default> select date '2001-09-28' + time '03:00';
result: 1 rows (9 B)
?plus
-------------------------------
2001-09-28 03:00:00

default> select interval '1 day' + interval '1 hour';
result: 1 rows (19 B)
?plus
-------------------------------
1 day 01:00:00

default> select timestamp '2001-09-28 01:00' + interval '23 hours';
result: 1 rows (9 B)
?plus
-------------------------------
2001-09-29 00:00:00

default> select time '01:00' + interval '3 hours';
result: 1 rows (9 B)
?plus
-------------------------------
04:00:00

default> select date '2001-10-01' - date '2001-09-28';
result: 1 rows (5 B)
?minus
-------------------------------
3

default> select date '2001-10-01' - 7;
result: 1 rows (5 B)
?minus
-------------------------------
2001-09-24

default> select date '2001-09-28' - interval '1 hour';
result: 1 rows (9 B)
?minus
-------------------------------
2001-09-27 23:00:00

default> select time '05:00' - time '03:00';
result: 1 rows (13 B)
?minus
-------------------------------
02:00:00

default> select time '05:00' - interval '2 hours';
result: 1 rows (9 B)
?minus
-------------------------------
03:00:00

default> select timestamp '2001-09-28 23:00' - interval '23 hours';
result: 1 rows (9 B)
?minus
-------------------------------
2001-09-28 00:00:00

default> select interval '1 day' - interval '1 hour';
result: 1 rows (13 B)
?minus
-------------------------------
23:00:00

default> select timestamp '2001-09-29 03:00' - timestamp '2001-09-27 12:00';
result: 1 rows (19 B)
?minus
-------------------------------
1 day 15:00:00

default> select 900 * interval '1 second';
result: 1 rows (13 B)
?multiply
-------------------------------
00:15:00

default> select 21 * interval '1 day';
result: 1 rows (12 B)
?multiply
-------------------------------
21 days

default> select 3.5 * interval '1 hour';
result: 1 rows (13 B)
?multiply
-------------------------------
03:30:00

default> select interval '1 hour' / 1.5;
result: 1 rows (13 B)
?divide
-------------------------------
00:40:00
{noformat}

And I added TO_DATE function in this patch in order to test INTERVAL_TYPE  in 
the real cluster. 
TO_DATE function converts a format string to a DATE type value. Currently, this 
function only supports Java date format string. 

> Implements INTERVAL type
> ------------------------
>
>                 Key: TAJO-761
>                 URL: https://issues.apache.org/jira/browse/TAJO-761
>             Project: Tajo
>          Issue Type: Sub-task
>            Reporter: hyoungjunkim
>            Assignee: hyoungjunkim
>         Attachments: TAJO-761.patch
>
>
> In order to provide the following features, INTERVAL Type is required.
> {noformat}
> babokim# select timestamp '2001-09-28 01:00' + interval '23 hours';
>       ?column?
> ---------------------
>  2001-09-29 00:00:00
> (1 row)
> babokim=# select date '2001-10-01' - date '2001-09-28';
>  ?column?
> ----------
>         3
> (1 row)
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to