Hive
  1. Hive
  2. HIVE-118

Add date related functions to Hive

    Details

    • Type: New Feature New Feature
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 0.3.0
    • Component/s: UDF
    • Labels:
      None
    • Hadoop Flags:
      Reviewed

      Description

      Add FromUnixTime, Year, Month, DayOfMonth, and Date functions as in mysql: http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html

        Issue Links

          Activity

          Zheng Shao created issue -
          Zheng Shao made changes -
          Field Original Value New Value
          Attachment HIVE-118-1.patch [ 12395316 ]
          Zheng Shao made changes -
          Status Open [ 1 ] Patch Available [ 10002 ]
          Hide
          Ashish Thusoo added a comment -

          +1

          Looks good to me.

          Show
          Ashish Thusoo added a comment - +1 Looks good to me.
          Hide
          Raghotham Murthy added a comment -

          +1

          looks good.

          Show
          Raghotham Murthy added a comment - +1 looks good.
          Hide
          Zheng Shao added a comment -

          Committed. svn revision: 723419

          Show
          Zheng Shao added a comment - Committed. svn revision: 723419
          Hide
          Zheng Shao added a comment -

          HIVE-118. Add date related functions. (zshao)

          Show
          Zheng Shao added a comment - HIVE-118 . Add date related functions. (zshao)
          Zheng Shao made changes -
          Resolution Fixed [ 1 ]
          Hadoop Flags [Reviewed]
          Status Patch Available [ 10002 ] Resolved [ 5 ]
          Hide
          David Phillips added a comment -

          Minor bug, this registers the wrong class:

          registerUDF("day", UDFDayOfMonth.class, OperatorType.PREFIX, false);

          We need tests that validate these functions. I'll work on that.

          Show
          David Phillips added a comment - Minor bug, this registers the wrong class: registerUDF("day", UDFDayOfMonth.class, OperatorType.PREFIX, false); We need tests that validate these functions. I'll work on that.
          David Phillips made changes -
          Link This issue blocks HIVE-137 [ HIVE-137 ]
          Hide
          Zheng Shao added a comment -

          Thanks for finding this out.
          We probably want to make both "day" and "dayofmonth" available to our users as synonyms, according to http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html

          Show
          Zheng Shao added a comment - Thanks for finding this out. We probably want to make both "day" and "dayofmonth" available to our users as synonyms, according to http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html
          Hide
          David Phillips added a comment -

          Sorry, I confused "day" with "date". Should we have a date function?

          registerUDF("date", UDFDate.class, OperatorType.PREFIX, false);

          Show
          David Phillips added a comment - Sorry, I confused "day" with "date". Should we have a date function? registerUDF("date", UDFDate.class, OperatorType.PREFIX, false);
          Hide
          Zheng Shao added a comment -

          We should have that but unfortunately the current code may recognize "date" as a predefined keyword. We might be able to specify `date`(xxx) where ` is the back quote on the left to "1" on the keyboard.

          If you could try it out and add it if it works that will be great.

          Also we do have the "to_date" function which probably does what you want. The name of "to_date" comes from oracle. But supporting what mysql does is our goal.

          Show
          Zheng Shao added a comment - We should have that but unfortunately the current code may recognize "date" as a predefined keyword. We might be able to specify `date`(xxx) where ` is the back quote on the left to "1" on the keyboard. If you could try it out and add it if it works that will be great. Also we do have the "to_date" function which probably does what you want. The name of "to_date" comes from oracle. But supporting what mysql does is our goal.
          Carl Steinbach made changes -
          Fix Version/s 0.3.0 [ 12313637 ]
          Component/s UDF [ 12313585 ]
          Carl Steinbach made changes -
          Status Resolved [ 5 ] Closed [ 6 ]
          Gavin made changes -
          Link This issue blocks HIVE-137 [ HIVE-137 ]
          Gavin made changes -
          Link This issue is depended upon by HIVE-137 [ HIVE-137 ]
          Transition Time In Source Status Execution Times Last Executer Last Execution Date
          Open Open Patch Available Patch Available
          1m 16s 1 Zheng Shao 04/Dec/08 19:45
          Patch Available Patch Available Resolved Resolved
          20m 16s 1 Zheng Shao 04/Dec/08 20:06
          Resolved Resolved Closed Closed
          1107d 4h 2m 1 Carl Steinbach 17/Dec/11 00:08

            People

            • Assignee:
              Zheng Shao
              Reporter:
              Zheng Shao
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development