You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hive.apache.org by "Zheng Shao (JIRA)" <ji...@apache.org> on 2009/02/27 07:14:02 UTC

[jira] Created: (HIVE-313) add UDF date_add, date_sub, datediff

add UDF date_add, date_sub, datediff
------------------------------------

                 Key: HIVE-313
                 URL: https://issues.apache.org/jira/browse/HIVE-313
             Project: Hadoop Hive
          Issue Type: New Feature
          Components: Query Processor
            Reporter: Zheng Shao


See http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_date-add
See http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_date-sub
See http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_datediff



-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (HIVE-313) add UDF date_add, date_sub, datediff

Posted by "Raghotham Murthy (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HIVE-313?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12681172#action_12681172 ] 

Raghotham Murthy commented on HIVE-313:
---------------------------------------

Couple things.

1. What's the locale you would be using for parsing the date? I'm guessing PST? How would you handle the case where data for a day when there was no daylight savings is queried on a day when there is daylight savings?

2. In the test query, can you change one of the functions to take as input a column from a table rather than all tests being constants? This is just to be sure that there is no weirdness when processing constants vs columns.

3. Do you need the calendar variable in UDFDateDiff?

> add UDF date_add, date_sub, datediff
> ------------------------------------
>
>                 Key: HIVE-313
>                 URL: https://issues.apache.org/jira/browse/HIVE-313
>             Project: Hadoop Hive
>          Issue Type: New Feature
>          Components: Query Processor
>            Reporter: Zheng Shao
>         Attachments: HIVE-313.1.patch
>
>
> See http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_date-add
> See http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_date-sub
> See http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_datediff

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (HIVE-313) add UDF date_add, date_sub, datediff

Posted by "Zheng Shao (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HIVE-313?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12677264#action_12677264 ] 

Zheng Shao commented on HIVE-313:
---------------------------------

{code}

DATE_ADD('2009-01-01', 1) = '2009-01-02'
DATE_SUB('2009-01-01', 1) = '2008-12-31'

DATEDIFF('2009-01-01', '2008-12-31') = 1

{code}


> add UDF date_add, date_sub, datediff
> ------------------------------------
>
>                 Key: HIVE-313
>                 URL: https://issues.apache.org/jira/browse/HIVE-313
>             Project: Hadoop Hive
>          Issue Type: New Feature
>          Components: Query Processor
>            Reporter: Zheng Shao
>
> See http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_date-add
> See http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_date-sub
> See http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_datediff

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (HIVE-313) add UDF date_add, date_sub, datediff

Posted by "Raghotham Murthy (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HIVE-313?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12681185#action_12681185 ] 

Raghotham Murthy commented on HIVE-313:
---------------------------------------

We should document the fact that we only do UTC now. Its probably not very intuitive to do date arithmetic in UTC if people are thinking in their own timezones. I guess we should support locales later (probably another jira).

Also, just checked the date_add spec in the URL specified above. It has a lot more functionality than what you have implemented. Similar with date_sub. Maybe file jiras to make these functions feature complete?

Btw, if you are confident that we dont have to add tests with table columns, I am fine by having only constants.

+1 as long as you file those jiras and add documentation to the Hive Language Manual :)

> add UDF date_add, date_sub, datediff
> ------------------------------------
>
>                 Key: HIVE-313
>                 URL: https://issues.apache.org/jira/browse/HIVE-313
>             Project: Hadoop Hive
>          Issue Type: New Feature
>          Components: Query Processor
>            Reporter: Zheng Shao
>         Attachments: HIVE-313.1.patch, HIVE-313.2.patch
>
>
> See http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_date-add
> See http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_date-sub
> See http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_datediff

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (HIVE-313) add UDF date_add, date_sub, datediff

Posted by "Zheng Shao (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HIVE-313?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Zheng Shao updated HIVE-313:
----------------------------

    Attachment: HIVE-313.1.patch

Added the UDFs.

> add UDF date_add, date_sub, datediff
> ------------------------------------
>
>                 Key: HIVE-313
>                 URL: https://issues.apache.org/jira/browse/HIVE-313
>             Project: Hadoop Hive
>          Issue Type: New Feature
>          Components: Query Processor
>            Reporter: Zheng Shao
>         Attachments: HIVE-313.1.patch
>
>
> See http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_date-add
> See http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_date-sub
> See http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_datediff

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (HIVE-313) add UDF date_add, date_sub, datediff

Posted by "Zheng Shao (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HIVE-313?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Zheng Shao updated HIVE-313:
----------------------------

    Attachment: HIVE-313.2.patch

Incorporated comments from Raghu. All dates are parsed as UTC now to avoid daylight saving problem.

I didn't put the data to the table though - we have been doing testing with constants for almost all UDFs till now. And these UDF functions are simple enough so I don't see much difference between testing with constants and with data from table.


> add UDF date_add, date_sub, datediff
> ------------------------------------
>
>                 Key: HIVE-313
>                 URL: https://issues.apache.org/jira/browse/HIVE-313
>             Project: Hadoop Hive
>          Issue Type: New Feature
>          Components: Query Processor
>            Reporter: Zheng Shao
>         Attachments: HIVE-313.1.patch, HIVE-313.2.patch
>
>
> See http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_date-add
> See http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_date-sub
> See http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_datediff

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (HIVE-313) add UDF date_add, date_sub, datediff

Posted by "Carl Steinbach (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HIVE-313?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Carl Steinbach updated HIVE-313:
--------------------------------

    Fix Version/s: 0.3.0
      Component/s: UDF
                       (was: Query Processor)

> add UDF date_add, date_sub, datediff
> ------------------------------------
>
>                 Key: HIVE-313
>                 URL: https://issues.apache.org/jira/browse/HIVE-313
>             Project: Hadoop Hive
>          Issue Type: New Feature
>          Components: UDF
>            Reporter: Zheng Shao
>             Fix For: 0.3.0
>
>         Attachments: HIVE-313.1.patch, HIVE-313.2.patch
>
>
> See http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_date-add
> See http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_date-sub
> See http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_datediff

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (HIVE-313) add UDF date_add, date_sub, datediff

Posted by "Carl Steinbach (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HIVE-313?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Carl Steinbach resolved HIVE-313.
---------------------------------

      Assignee: Zheng Shao
    Resolution: Fixed

> add UDF date_add, date_sub, datediff
> ------------------------------------
>
>                 Key: HIVE-313
>                 URL: https://issues.apache.org/jira/browse/HIVE-313
>             Project: Hadoop Hive
>          Issue Type: New Feature
>          Components: UDF
>            Reporter: Zheng Shao
>            Assignee: Zheng Shao
>             Fix For: 0.3.0
>
>         Attachments: HIVE-313.1.patch, HIVE-313.2.patch
>
>
> See http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_date-add
> See http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_date-sub
> See http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_datediff

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.