hive-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject Re: Review Request 53983: HIVE-14582 : Add trunc(numeric) udf
Date Wed, 30 Nov 2016 19:04:12 GMT

This is an automatically generated e-mail. To reply, visit:

(Updated Nov. 30, 2016, 7:04 p.m.)

Review request for hive and Ashutosh Chauhan.


Updated diff like, now trun() function will accept non constants as scale argument. Updated
test cases also. All tests are pass in local environment.

Repository: hive-git


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 (updated)

  data/files/trunc_number.txt PRE-CREATION 
  data/files/trunc_number1.txt PRE-CREATION 
  ql/src/java/org/apache/hadoop/hive/ql/udf/generic/ e20ad65 
  ql/src/test/queries/clientnegative/udf_trunc_error3.q PRE-CREATION 
  ql/src/test/queries/clientpositive/udf_trunc_number.q PRE-CREATION 
  ql/src/test/results/clientnegative/udf_trunc_error1.q.out 5d65b11 
  ql/src/test/results/clientnegative/udf_trunc_error2.q.out 55a2185 
  ql/src/test/results/clientnegative/udf_trunc_error3.q.out PRE-CREATION 
  ql/src/test/results/clientpositive/udf_trunc.q.out 4c9f76d 
  ql/src/test/results/clientpositive/udf_trunc_number.q.out PRE-CREATION 



All tests are pass.



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