[ https://issues.apache.org/jira/browse/HIVE-3976?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14551959#comment-14551959 ]
Zhongshuai Pei commented on HIVE-3976: -------------------------------------- [~xuefu.w...@kodak.com] I read your design document "Hive Decimal Precision/Scale Support", but i did not find the rule of operations that the doc describes in Hive code : {noformat} Operation Result precision Result scale e1 + e2 max(s1, s2) + max(p1-s1, p2-s2) + 1 max(s1, s2) e1 - e2 max(s1, s2) + max(p1-s1, p2-s2) + 1 max(s1, s2) e1 * e2 p1 + p2 + 1 s1 + s2 e1 / e2 p1 - s1 + s2 + max(6, s1 + p2 + 1) max(6, s1 + p2 + 1) e1 % e2 min(p1-s1, p2 -s2) + max( s1,s2 ) max(s1, s2) {noformat} Did it changed? > 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 > Affects Versions: 0.11.0 > Reporter: Mark Grover > Assignee: Xuefu Zhang > Fix For: 0.13.0 > > Attachments: HIVE-3976.1.patch, HIVE-3976.10.patch, > HIVE-3976.11.patch, HIVE-3976.2.patch, HIVE-3976.3.patch, HIVE-3976.4.patch, > HIVE-3976.5.patch, HIVE-3976.6.patch, HIVE-3976.7.patch, HIVE-3976.8.patch, > HIVE-3976.9.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 was sent by Atlassian JIRA (v6.3.4#6332)