Uploaded image for project: 'Hive'
  1. Hive
  2. HIVE-9480

Build UDF TRUNC to implement FIRST_DAY as compared with LAST_DAY

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.2.0
    • UDF
    • None

    Description

      Hive already supports LAST_DAY UDF, in some cases, FIRST_DAY is necessary to do date/timestamp related computation. This JIRA is to track such an implementation. Choose to impl TRUNC, a more standard way to get the first day of a a month, e.g., SELECT TRUNC('2009-12-12', 'MM'); will return 2009-12-01, SELECT TRUNC('2009-12-12', 'YEAR'); will return 2009-01-01.

      BTW, this TRUNC is not as feature complete as aligned with Oracle one. only 'MM' and 'YEAR' are supported as format, however, it's a base to add on other formats.

      Attachments

        1. HIVE-9480.9.patch
          77 kB
          Xiaobing Zhou
        2. HIVE-9480.8.patch
          77 kB
          Xiaobing Zhou
        3. HIVE-9480.7.patch
          77 kB
          Xiaobing Zhou
        4. HIVE-9480.6.patch
          67 kB
          Xiaobing Zhou
        5. HIVE-9480.5.patch
          67 kB
          Xiaobing Zhou
        6. HIVE-9480.4.patch
          45 kB
          Xiaobing Zhou
        7. HIVE-9480.3.patch
          19 kB
          Xiaobing Zhou
        8. HIVE-9480.1.patch
          15 kB
          Xiaobing Zhou

        Issue Links

          Activity

            People

              xiaobingo Xiaobing Zhou
              xiaobingo Xiaobing Zhou
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: