hive-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Xuefu Zhang (JIRA)" <>
Subject [jira] [Commented] (HIVE-3976) Support specifying scale and precision with Hive decimal type
Date Thu, 26 Sep 2013 03:04:03 GMT


Xuefu Zhang commented on HIVE-3976:

[~jdere] Thank you very much for your early feedback. 

Re: #1. I can see in patch #1.
    #2. Thanks for noticing that. I was consolidating this logic but still forgot this class.
It should be synched with other parts of the code.
    #3. A type decimal(5,3) signifies that at most two digits are allowed for integer part
because 3 is allocated for decimal part. With this, the biggest value it can take is 99.999.
Thus, a value greater than 99.999 shouldn't be allowed for this type. Here is what mysql does
in default mode:

mysql> CREATE TABLE t3 (d  DECIMAL(5,3));
Query OK, 0 rows affected (0.12 sec)

mysql> insert into t3 values (123.45);
Query OK, 1 row affected, 1 warning (0.04 sec)

mysql> select * from t3;
| d      |
| 99.999 |
1 row in set (0.00 sec)


I believe that under strict mode, the value will be rejected. Since Hive currently only has
a strict mode, we choose null in this case.  With other modes in the future, we may have different
behaviour. Regardless, I don't think decimal(5,3) should hold more than 2 integer digits.

    #4. I will check what's the difference between BidDecimal.scale() and decimal.scale().
In the meantime, could you be specific about what you know of the difference.
> Support specifying scale and precision with Hive decimal type
> -------------------------------------------------------------
>                 Key: HIVE-3976
>                 URL:
>             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
> 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:

View raw message