Chaoyu Tang created HIVE-14347:
----------------------------------

             Summary: Inconsistent hehavior in decimal multiplication
                 Key: HIVE-14347
                 URL: https://issues.apache.org/jira/browse/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 plan. 
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
(v6.3.4#6332)

Reply via email to