You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hive.apache.org by "Jagruti Varia (JIRA)" <ji...@apache.org> on 2015/05/29 03:03:17 UTC

[jira] [Created] (HIVE-10861) can't use trunc() udf without specifying format

Jagruti Varia created HIVE-10861:
------------------------------------

             Summary: can't use trunc() udf without specifying format
                 Key: HIVE-10861
                 URL: https://issues.apache.org/jira/browse/HIVE-10861
             Project: Hive
          Issue Type: Bug
    Affects Versions: 1.2.0
            Reporter: Jagruti Varia
            Assignee: Jason Dere


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

{noformat}
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
{noformat}

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



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)