hive-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chaoyu Tang (JIRA)" <>
Subject [jira] [Created] (HIVE-14347) Inconsistent hehavior in decimal multiplication
Date Tue, 26 Jul 2016 22:42:20 GMT
Chaoyu Tang created HIVE-14347:

             Summary: Inconsistent hehavior in decimal multiplication
                 Key: HIVE-14347
             Project: Hive
          Issue Type: Bug
          Components: Types
            Reporter: Chaoyu Tang
            Assignee: Chaoyu Tang

1. select cast('20' as decimal(38,18)) * cast('10' as decimal(38,18)) from test;
returns 200, but the type of multiplication result is decimal (38,36) as shown in the query
2.  select a*b from atable where column a and b with both column type of decimal (38,18) and
column value 20 and 10 respectively, we get result NULL but type decimal (38, 36).
If we strictly follow current precision/scale manipulations for the decimal multiplication
in Hive, the result in case1 400 has already exceeded the data range that decimal (38, 36)
supports and it should return null. 
Current Hive deduces the precision/scale from constant values (10 and 20) and use them (2,
0) instead of the specified precision/scale (38, 18) in the multiplication. 

This message was sent by Atlassian JIRA

View raw message