hive-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Teddy Choi (JIRA)" <>
Subject [jira] [Commented] (HIVE-5022) Decimal Arithmetic generates NULL value
Date Tue, 13 Aug 2013 06:46:49 GMT


Teddy Choi commented on HIVE-5022:

The result of division has the maximum precision. The following multiplication makes a result
with a greater precision than the maximum precision, so it causes an error.
provides more information.

Please use ROUND() to reduce precisions or use DOUBLE to be tolerant of precision issues.
> Decimal Arithmetic generates NULL value
> ---------------------------------------
>                 Key: HIVE-5022
>                 URL:
>             Project: Hive
>          Issue Type: Bug
>          Components: Types
>    Affects Versions: 0.11.0
>         Environment: Hortonworks 1.3 running Hive
>            Reporter: Kevin Soo Hoo
> 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:

View raw message