hive-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jason Dere (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HIVE-3976) Support specifying scale and precision with Hive decimal type
Date Thu, 26 Sep 2013 00:17:04 GMT

    [ https://issues.apache.org/jira/browse/HIVE-3976?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13778275#comment-13778275
] 

Jason Dere commented on HIVE-3976:
----------------------------------

Took a look at the patch, pretty good so far. Some comments/questions:

1. Patch is missing HiveDecimalUtils.java

2. LazyHiveDecimalObjectInspector.getPrimitiveJavaObject(): We should only be returning null
when the integral portion of the HiveDecimal exceeds the integral portion of the typeParams,
so I think here it should be checking (result.precision - result.scale) <= (params.precision()
- params.scale()).  Otherwise we would return null here with type params of (5, 2), if the
result was 0.123456 (decimal(6,6)), because the precision of the result is larger than 5.

3. HiveDecimal.enforcePrecisionScale(): I think here we're allowing integer values larger
than should be allowed, because it's shrinking the scale based on the size of the value. I
was under the impression that for a decimal(5, 3) we can't assign any values larger than 99.999.

4. Looks like there is potentially a difference between HiveDecimal.bd.scale() and the defined
scale of the decimal type params.  Just wondering if there are any issues that might arise
from that.
                
> Support specifying scale and precision with Hive decimal type
> -------------------------------------------------------------
>
>                 Key: HIVE-3976
>                 URL: https://issues.apache.org/jira/browse/HIVE-3976
>             Project: Hive
>          Issue Type: New Feature
>          Components: Query Processor, Types
>            Reporter: Mark Grover
>            Assignee: Xuefu Zhang
>         Attachments: HIVE-3976.1.patch, HIVE-3976.patch, remove_prec_scale.diff
>
>
> HIVE-2693 introduced support for Decimal datatype in Hive. However, the current implementation
has unlimited precision and provides no way to specify precision and scale when creating the
table.
> For example, MySQL allows users to specify scale and precision of the decimal datatype
when creating the table:
> {code}
> CREATE TABLE numbers (a DECIMAL(20,2));
> {code}
> Hive should support something similar too.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message