[ 
https://issues.apache.org/jira/browse/HIVE-5022?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13754303#comment-13754303
 ] 

Jason Dere commented on HIVE-5022:
----------------------------------

Just want to point out that there is also HIVE-3976 which will eventually allow 
a user to specify decimal precision/scale.  This may help a bit, if there are 
rules about the precision/scale of a result based an arithmetic operation 
between values of known precision/scale. Also want to make sure that whatever 
is done here makes sense with what is being done with HIVE-3976.  Does anyone 
know what the SQL reference says about how this should be handled? I'll try to 
take a look at what the reference says.
                
> Decimal Arithmetic generates NULL value
> ---------------------------------------
>
>                 Key: HIVE-5022
>                 URL: https://issues.apache.org/jira/browse/HIVE-5022
>             Project: Hive
>          Issue Type: Bug
>          Components: Types
>    Affects Versions: 0.11.0
>         Environment: Hortonworks 1.3 running Hive 0.11.0.1.3.0.0-107
>            Reporter: Kevin Soo Hoo
>            Assignee: Teddy Choi
>         Attachments: HIVE-5022.1.patch.txt, HIVE-5022.2.patch.txt, 
> HIVE-5022.3.patch.txt
>
>
> When a decimal division is the first operation, the quotient cannot be 
> multiplied in a subsequent calculation. Instead, a NULL is returned. 
> The following yield NULL results:
> select (cast (4.53 as decimal) / cast(25.86 as decimal)) * cast(0.087 as 
> decimal) from <tablename> limit 1;
> select cast (4.53 as decimal) / cast(25.86 as decimal) * cast(0.087 as 
> decimal) from <tablename> limit 1;
> If we move the multiplication operation to be first, then it will 
> successfully calculate the result.

--
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

Reply via email to