[ https://issues.apache.org/jira/browse/HIVE-3976?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13765171#comment-13765171 ]
Xuefu Zhang commented on HIVE-3976: ----------------------------------- [~mgrover] Thanks for your feedback. {quote} 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)? {quote} 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 http://dev.mysql.com/doc/refman/5.1/en/precision-math-rounding.html. 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: https://issues.apache.org/jira/browse/HIVE-3976 > 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 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