hive-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chinna...@huawei.com
Subject Review Request 53983: HIVE-14582 : Add trunc(numeric) udf
Date Tue, 22 Nov 2016 13:28:21 GMT

-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/53983/
-----------------------------------------------------------

Review request for hive and Ashutosh Chauhan.


Repository: hive-git


Description
-------

Overload trunc() function to accept numbers.

Now trunc() will accept date or number type arguments and it will behave as below

trunc(date, fmt) / trunc(N,D) - Returns

If input is date 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.

If input is a number group returns N truncated to D decimal places. If D is omitted, then
N is truncated to 0 places.
D can be negative to truncate (make zero) D digits left of the decimal point.


Diffs
-----

  ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFTrunc.java e20ad65 
  ql/src/test/queries/clientpositive/udf_trunc_number.q PRE-CREATION 
  ql/src/test/results/clientpositive/udf_trunc.q.out 4c9f76d 
  ql/src/test/results/clientpositive/udf_trunc_number.q.out PRE-CREATION 

Diff: https://reviews.apache.org/r/53983/diff/


Testing
-------

All tests are pass.


Thanks,

chinna


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message