hive-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Vineet Garg <vg...@hortonworks.com>
Subject Re: Review Request 53983: HIVE-14582 : Add trunc(numeric) udf
Date Thu, 01 Dec 2016 00:05:28 GMT

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




ql/src/test/queries/clientnegative/udf_trunc_error3.q (line 1)
<https://reviews.apache.org/r/53983/#comment228064>

    I think it'll be good to add tests with negative numbers as well as no-op (e.g. select
trunc (12.34, 100).


- Vineet Garg


On Nov. 30, 2016, 7:04 p.m., Chinna Rao Lalam wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/53983/
> -----------------------------------------------------------
> 
> (Updated Nov. 30, 2016, 7:04 p.m.)
> 
> 
> 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
> -----
> 
>   data/files/trunc_number.txt PRE-CREATION 
>   data/files/trunc_number1.txt PRE-CREATION 
>   ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFTrunc.java 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 
> 
> Diff: https://reviews.apache.org/r/53983/diff/
> 
> 
> Testing
> -------
> 
> All tests are pass.
> 
> 
> Thanks,
> 
> Chinna Rao Lalam
> 
>


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