You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hive.apache.org by Vineet Garg <vg...@hortonworks.com> on 2016/12/01 00:05:28 UTC

Re: Review Request 53983: HIVE-14582 : Add trunc(numeric) udf

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


Re: Review Request 53983: HIVE-14582 : Add trunc(numeric) udf

Posted by Chinna Rao Lalam <la...@gmail.com>.

> On Dec. 1, 2016, 12:05 a.m., Vineet Garg wrote:
> > ql/src/test/queries/clientnegative/udf_trunc_error3.q, line 1
> > <https://reviews.apache.org/r/53983/diff/2/?file=1573142#file1573142line1>
> >
> >     I think it'll be good to add tests with negative numbers as well as no-op (e.g. select trunc (12.34, 100).

Thanks for the review. I will add tests as part of this JIRA HIVE-15325


- Chinna Rao


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


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