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, 12 Sep 2013 05:29:51 GMT


Xuefu Zhang commented on HIVE-3976:

[~mgrover] Thanks for your feedback.

One minor question, in the document you mention "Specifically, for +/, the result scale is
s1 + s2, and for multiplication, max(s1, s2)". Did you mean the other way around (max for
+/, s1+s2 for multiplication)?

You're right. I will correct this in the doc.

Regarding error handling, some DB has different modes that controls the behavior. Since Hive
doesn't have such a setting yet, I think we can implement a default behavior but keep the
door open to more options in the future. 

As to rounding behavior, I think providing a config on the rounding method could be an overkill.
In fact, mysql is very clear on the rounding method. For decimal, it uses "round half up".
More information can be found at
The document borrows the mysql's way of  decimal rounding, i.e rounding is always allowed
for fractional part regardless of server mode. I think is more reasonable and practical. I
will update the doc to make more explicit.

I have to say that the error handling regarding numeric types are very complex. It appears
to me that in most cases how a DB does it doesn't really matter. What matters is to document
clearly. Hive needs to do this as well.

> Support specifying scale and precision with Hive decimal type
> -------------------------------------------------------------
>                 Key: HIVE-3976
>                 URL:
>             Project: Hive
>          Issue Type: Improvement
>          Components: Query Processor, Types
>            Reporter: Mark Grover
>            Assignee: Xuefu Zhang
>         Attachments: 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