You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hive.apache.org by Xuefu Zhang <xz...@cloudera.com> on 2013/12/17 22:26:59 UTC
Review Request 16329: HIVE-6039: Round,
AVG and SUM functions reject char/varch input while accepting string input
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/16329/
-----------------------------------------------------------
Review request for hive and Prasad Mujumdar.
Bugs: HIVE-6039
https://issues.apache.org/jira/browse/HIVE-6039
Repository: hive-git
Description
-------
Allow input to these UDFs for char and varchar.
Diffs
-----
data/files/char_varchar_udf.txt PRE-CREATION
ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDAFAverage.java 4b219bd
ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDAFSum.java 41d5efd
ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFRound.java fc9c1b2
ql/src/test/queries/clientpositive/char_varchar_udf.q PRE-CREATION
ql/src/test/results/clientpositive/char_varchar_udf.q.out PRE-CREATION
Diff: https://reviews.apache.org/r/16329/diff/
Testing
-------
Unit tested. New test added. Test suite passed.
Thanks,
Xuefu Zhang
Re: Review Request 16329: HIVE-6039: Round,
AVG and SUM functions reject char/varch input while accepting string input
Posted by Prasad Mujumdar <pr...@cloudera.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/16329/#review30711
-----------------------------------------------------------
Ship it!
LGMT
- Prasad Mujumdar
On Dec. 17, 2013, 9:26 p.m., Xuefu Zhang wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/16329/
> -----------------------------------------------------------
>
> (Updated Dec. 17, 2013, 9:26 p.m.)
>
>
> Review request for hive and Prasad Mujumdar.
>
>
> Bugs: HIVE-6039
> https://issues.apache.org/jira/browse/HIVE-6039
>
>
> Repository: hive-git
>
>
> Description
> -------
>
> Allow input to these UDFs for char and varchar.
>
>
> Diffs
> -----
>
> data/files/char_varchar_udf.txt PRE-CREATION
> ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDAFAverage.java 4b219bd
> ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDAFSum.java 41d5efd
> ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFRound.java fc9c1b2
> ql/src/test/queries/clientpositive/char_varchar_udf.q PRE-CREATION
> ql/src/test/results/clientpositive/char_varchar_udf.q.out PRE-CREATION
>
> Diff: https://reviews.apache.org/r/16329/diff/
>
>
> Testing
> -------
>
> Unit tested. New test added. Test suite passed.
>
>
> Thanks,
>
> Xuefu Zhang
>
>
Re: Review Request 16329: HIVE-6039: Round,
AVG and SUM functions reject char/varch input while accepting string input
Posted by Xuefu Zhang <xz...@cloudera.com>.
> On Dec. 19, 2013, 6:54 a.m., Prasad Mujumdar wrote:
> > ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFRound.java, line 151
> > <https://reviews.apache.org/r/16329/diff/1/?file=398948#file398948line151>
> >
> > I do agree that "Only numeric data types allowed" is a bit misleading since we do support string types as well ..
Guys, I appreciated your feedback. However, your comment is about the code that I didn't change. If you feel like that a change is needed, I guess a different JIRA is more appropriate. Thanks.
- Xuefu
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/16329/#review30678
-----------------------------------------------------------
On Dec. 17, 2013, 9:26 p.m., Xuefu Zhang wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/16329/
> -----------------------------------------------------------
>
> (Updated Dec. 17, 2013, 9:26 p.m.)
>
>
> Review request for hive and Prasad Mujumdar.
>
>
> Bugs: HIVE-6039
> https://issues.apache.org/jira/browse/HIVE-6039
>
>
> Repository: hive-git
>
>
> Description
> -------
>
> Allow input to these UDFs for char and varchar.
>
>
> Diffs
> -----
>
> data/files/char_varchar_udf.txt PRE-CREATION
> ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDAFAverage.java 4b219bd
> ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDAFSum.java 41d5efd
> ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFRound.java fc9c1b2
> ql/src/test/queries/clientpositive/char_varchar_udf.q PRE-CREATION
> ql/src/test/results/clientpositive/char_varchar_udf.q.out PRE-CREATION
>
> Diff: https://reviews.apache.org/r/16329/diff/
>
>
> Testing
> -------
>
> Unit tested. New test added. Test suite passed.
>
>
> Thanks,
>
> Xuefu Zhang
>
>
Re: Review Request 16329: HIVE-6039: Round,
AVG and SUM functions reject char/varch input while accepting string input
Posted by Xuefu Zhang <xz...@cloudera.com>.
> On Dec. 19, 2013, 6:54 a.m., Prasad Mujumdar wrote:
> > The patch overall looks fine to. A minor suggestion below.
> >
> > I am wondering if the string value (string, char or varchar) is in the decimal format (scientific or non-scientific), the converting to double won't work. Do you think it's better to convert the string values to decimal in all these cases ?
> > If not, it might be helpful to document that behavior.
> >
In hive, String type used in the numeric context is consistently converted to double, an approximate type. If scientific number cannot be converted, that should be solved in a separate JIRA. I don't think we should convert an approximate type to an exact type which is the principle that Hive is following.
> On Dec. 19, 2013, 6:54 a.m., Prasad Mujumdar wrote:
> > ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFRound.java, line 151
> > <https://reviews.apache.org/r/16329/diff/1/?file=398948#file398948line151>
> >
> > I do agree that "Only numeric data types allowed" is a bit misleading since we do support string types as well ..
>
> Xuefu Zhang wrote:
> Guys, I appreciated your feedback. However, your comment is about the code that I didn't change. If you feel like that a change is needed, I guess a different JIRA is more appropriate. Thanks.
>
> Prasad Mujumdar wrote:
> that's true. This is all these issues were applicable to STRING type as well.
> A followup jira would be helpful, especially to consider decimal conversion for string types. Thanks!
Okay. I will create a JIRA for this.
- Xuefu
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/16329/#review30678
-----------------------------------------------------------
On Dec. 17, 2013, 9:26 p.m., Xuefu Zhang wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/16329/
> -----------------------------------------------------------
>
> (Updated Dec. 17, 2013, 9:26 p.m.)
>
>
> Review request for hive and Prasad Mujumdar.
>
>
> Bugs: HIVE-6039
> https://issues.apache.org/jira/browse/HIVE-6039
>
>
> Repository: hive-git
>
>
> Description
> -------
>
> Allow input to these UDFs for char and varchar.
>
>
> Diffs
> -----
>
> data/files/char_varchar_udf.txt PRE-CREATION
> ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDAFAverage.java 4b219bd
> ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDAFSum.java 41d5efd
> ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFRound.java fc9c1b2
> ql/src/test/queries/clientpositive/char_varchar_udf.q PRE-CREATION
> ql/src/test/results/clientpositive/char_varchar_udf.q.out PRE-CREATION
>
> Diff: https://reviews.apache.org/r/16329/diff/
>
>
> Testing
> -------
>
> Unit tested. New test added. Test suite passed.
>
>
> Thanks,
>
> Xuefu Zhang
>
>
Re: Review Request 16329: HIVE-6039: Round,
AVG and SUM functions reject char/varch input while accepting string input
Posted by Prasad Mujumdar <pr...@cloudera.com>.
> On Dec. 19, 2013, 6:54 a.m., Prasad Mujumdar wrote:
> > ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFRound.java, line 151
> > <https://reviews.apache.org/r/16329/diff/1/?file=398948#file398948line151>
> >
> > I do agree that "Only numeric data types allowed" is a bit misleading since we do support string types as well ..
>
> Xuefu Zhang wrote:
> Guys, I appreciated your feedback. However, your comment is about the code that I didn't change. If you feel like that a change is needed, I guess a different JIRA is more appropriate. Thanks.
that's true. This is all these issues were applicable to STRING type as well.
A followup jira would be helpful, especially to consider decimal conversion for string types. Thanks!
- Prasad
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/16329/#review30678
-----------------------------------------------------------
On Dec. 17, 2013, 9:26 p.m., Xuefu Zhang wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/16329/
> -----------------------------------------------------------
>
> (Updated Dec. 17, 2013, 9:26 p.m.)
>
>
> Review request for hive and Prasad Mujumdar.
>
>
> Bugs: HIVE-6039
> https://issues.apache.org/jira/browse/HIVE-6039
>
>
> Repository: hive-git
>
>
> Description
> -------
>
> Allow input to these UDFs for char and varchar.
>
>
> Diffs
> -----
>
> data/files/char_varchar_udf.txt PRE-CREATION
> ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDAFAverage.java 4b219bd
> ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDAFSum.java 41d5efd
> ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFRound.java fc9c1b2
> ql/src/test/queries/clientpositive/char_varchar_udf.q PRE-CREATION
> ql/src/test/results/clientpositive/char_varchar_udf.q.out PRE-CREATION
>
> Diff: https://reviews.apache.org/r/16329/diff/
>
>
> Testing
> -------
>
> Unit tested. New test added. Test suite passed.
>
>
> Thanks,
>
> Xuefu Zhang
>
>
Re: Review Request 16329: HIVE-6039: Round,
AVG and SUM functions reject char/varch input while accepting string input
Posted by Prasad Mujumdar <pr...@cloudera.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/16329/#review30678
-----------------------------------------------------------
The patch overall looks fine to. A minor suggestion below.
I am wondering if the string value (string, char or varchar) is in the decimal format (scientific or non-scientific), the converting to double won't work. Do you think it's better to convert the string values to decimal in all these cases ?
If not, it might be helpful to document that behavior.
ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFRound.java
<https://reviews.apache.org/r/16329/#comment58773>
I do agree that "Only numeric data types allowed" is a bit misleading since we do support string types as well ..
- Prasad Mujumdar
On Dec. 17, 2013, 9:26 p.m., Xuefu Zhang wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/16329/
> -----------------------------------------------------------
>
> (Updated Dec. 17, 2013, 9:26 p.m.)
>
>
> Review request for hive and Prasad Mujumdar.
>
>
> Bugs: HIVE-6039
> https://issues.apache.org/jira/browse/HIVE-6039
>
>
> Repository: hive-git
>
>
> Description
> -------
>
> Allow input to these UDFs for char and varchar.
>
>
> Diffs
> -----
>
> data/files/char_varchar_udf.txt PRE-CREATION
> ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDAFAverage.java 4b219bd
> ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDAFSum.java 41d5efd
> ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFRound.java fc9c1b2
> ql/src/test/queries/clientpositive/char_varchar_udf.q PRE-CREATION
> ql/src/test/results/clientpositive/char_varchar_udf.q.out PRE-CREATION
>
> Diff: https://reviews.apache.org/r/16329/diff/
>
>
> Testing
> -------
>
> Unit tested. New test added. Test suite passed.
>
>
> Thanks,
>
> Xuefu Zhang
>
>
Re: Review Request 16329: HIVE-6039: Round,
AVG and SUM functions reject char/varch input while accepting string input
Posted by Mohammad Islam <mi...@yahoo.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/16329/#review30672
-----------------------------------------------------------
Looks good to go. very minor comments added.
ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDAFAverage.java
<https://reviews.apache.org/r/16329/#comment58769>
Will it be better to explicitly add char and varchar as accepted type in the message?
ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDAFSum.java
<https://reviews.apache.org/r/16329/#comment58770>
same here.
ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFRound.java
<https://reviews.apache.org/r/16329/#comment58771>
Same. more informative message could be helpful.
- Mohammad Islam
On Dec. 17, 2013, 9:26 p.m., Xuefu Zhang wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/16329/
> -----------------------------------------------------------
>
> (Updated Dec. 17, 2013, 9:26 p.m.)
>
>
> Review request for hive and Prasad Mujumdar.
>
>
> Bugs: HIVE-6039
> https://issues.apache.org/jira/browse/HIVE-6039
>
>
> Repository: hive-git
>
>
> Description
> -------
>
> Allow input to these UDFs for char and varchar.
>
>
> Diffs
> -----
>
> data/files/char_varchar_udf.txt PRE-CREATION
> ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDAFAverage.java 4b219bd
> ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDAFSum.java 41d5efd
> ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFRound.java fc9c1b2
> ql/src/test/queries/clientpositive/char_varchar_udf.q PRE-CREATION
> ql/src/test/results/clientpositive/char_varchar_udf.q.out PRE-CREATION
>
> Diff: https://reviews.apache.org/r/16329/diff/
>
>
> Testing
> -------
>
> Unit tested. New test added. Test suite passed.
>
>
> Thanks,
>
> Xuefu Zhang
>
>