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

can't use trunc() udf without specifying format

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 1.2.0
    • None
    • None
    • None

    Description

      From the description, it seems like format argument can be omitted while using trunc() udf. But it throws an error if only date argument is provided.

      hive> desc function trunc;
      OK
      trunc(date, fmt) - Returns returns date with the time portion of the day truncated to the unit specified by the format model fmt. If you omit fmt, then date is truncated to the nearest day. It now only supports 'MONTH'/'MON'/'MM' and 'YEAR'/'YYYY'/'YY' as format.
      Time taken: 0.019 seconds, Fetched: 1 row(s)
      hive> select trunc('2015-12-11');
      FAILED: SemanticException [Error 10015]: Line 1:7 Arguments length mismatch ''2015-12-11'': trunc() requires 2 argument, got 1
      

      UDF wiki
      https://cwiki.apache.org/confluence/display/Hive/LanguageManual+UDF

      Attachments

        Activity

          People

            jdere Jason Dere
            jvaria Jagruti Varia
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: