[ https://issues.apache.org/jira/browse/HIVE-9518?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Alexander Pivovarov updated HIVE-9518: -------------------------------------- Attachment: HIVE-9518.9.patch The function should support both short date and full timestamp string format and it should not skip time part. String lenght can not be used to determine the format because year might be less that 4 chars and day and month can be just 1 char This is why I decided to use both Timestamp and Date converters to convert input value to java Date. I also removed the fix I did before to GenericUDF which consider string lenght (str.length==10) I added tests for dates without day, dates with partial time (no seconds) and dates with short year, month and day. Now string Dates parsing behavious shold be consistend with other UDFs (e.g. datediff) > Implement MONTHS_BETWEEN aligned with Oracle one > ------------------------------------------------ > > Key: HIVE-9518 > URL: https://issues.apache.org/jira/browse/HIVE-9518 > Project: Hive > Issue Type: Improvement > Components: UDF > Reporter: Xiaobing Zhou > Assignee: Alexander Pivovarov > Attachments: HIVE-9518.1.patch, HIVE-9518.2.patch, HIVE-9518.3.patch, > HIVE-9518.4.patch, HIVE-9518.5.patch, HIVE-9518.6.patch, HIVE-9518.7.patch, > HIVE-9518.8.patch, HIVE-9518.9.patch > > > This is used to track work to build Oracle like months_between. Here's > semantics: > MONTHS_BETWEEN returns number of months between dates date1 and date2. If > date1 is later than date2, then the result is positive. If date1 is earlier > than date2, then the result is negative. If date1 and date2 are either the > same days of the month or both last days of months, then the result is always > an integer. Otherwise Oracle Database calculates the fractional portion of > the result based on a 31-day month and considers the difference in time > components date1 and date2. > Should accept date, timestamp and string arguments in the format 'yyyy-MM-dd' > or 'yyyy-MM-dd HH:mm:ss'. > The result should be rounded to 8 decimal places. -- This message was sent by Atlassian JIRA (v6.3.4#6332)