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
Create tests for new date functions
Looks good to me.
Committed. svn revision: 723419
HIVE-118. Add date related functions. (zshao)
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.
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
Sorry, I confused "day" with "date". Should we have a date function?
registerUDF("date", UDFDate.class, OperatorType.PREFIX, false);
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.