[ https://issues.apache.org/jira/browse/HIVE-14281?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15384793#comment-15384793 ]
Chaoyu Tang commented on HIVE-14281: ------------------------------------ Another use case if we use a decimal with small scale such as decimal (38, 6): {cdoe} create table test1 (a decimal(38, 6), b decimal(38, 6), c decimal(38, 6), d decimal(38, 6), e decimal(38, 6), f decimal(38, 6)) insert into test1 values (1.000000, 2.000000, 3.000000, 4.000000, 5.000000, 6.000000); hive> explain select a*b*c*d*e*f from test1; OK STAGE DEPENDENCIES: Stage-0 is a root stage STAGE PLANS: Stage: Stage-0 Fetch Operator limit: -1 Processor Tree: TableScan alias: test1 Statistics: Num rows: 1 Data size: 53 Basic stats: COMPLETE Column stats: NONE Select Operator expressions: (((((a * b) * c) * d) * e) * f) (type: decimal(38,36)) outputColumnNames: _col0 Statistics: Num rows: 1 Data size: 53 Basic stats: COMPLETE Column stats: NONE ListSink hive> select a*b*c*d*e*f from test1; OK NULL {code} > Issue in decimal multiplication > ------------------------------- > > Key: HIVE-14281 > URL: https://issues.apache.org/jira/browse/HIVE-14281 > Project: Hive > Issue Type: Bug > Components: Types > Reporter: Chaoyu Tang > Assignee: Chaoyu Tang > > {code} > CREATE TABLE test (a DECIMAL(38,18), b DECIMAL(38,18)); > INSERT OVERWRITE TABLE test VALUES (20, 20); > SELECT a*b from test > {code} > The returned result is NULL (instead of 400) > It is because Hive adds the scales from operands and the type for a*b is set > to decimal (38, 36). Hive could not handle this case properly (e.g. by > rounding) -- This message was sent by Atlassian JIRA (v6.3.4#6332)