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

          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)
          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.
          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.

            People

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

              Dates

              • Created:
                Updated:
                Resolved:

                Development