Decimal literals

The default treatment of Decimal literals in Hive was changed from Double to Decimal as per the SQL standards.

Before upgrade to CDP

Decimal value is displayed as a rounded value when you run a SELECT statement where column = decimal value. For example,
create table test (dc decimal(38,18));
insert into table test values (4327269606205.029297);

select * from test;
Output:
+-----------------------------------+--+
|              test.dc              |
+-----------------------------------+--+
| 4327269606205.029297000000000000  |
+-----------------------------------+--+

select * from test where dc = 4327269606205.029297000000000000;
Output:
+-----------------------------------+--+
|              test.dc              |
+-----------------------------------+--+
| 4327269606205.029300000000000000  |
+-----------------------------------+--+

After upgrade to CDP

The fix changed the default treatment of Decimal literals in Hive and now prefers Decimal over Double.

This fix also influences other functions which accept such numeric values as parameters. For example:

select coalesce(2.0, ‘EMPTY’)

The coalesce functions' return type in this expression is string. In CDH, 2.0 was parsed as Java double and returned ‘2.0’. In CDP, it is parsed as HiveDecimal(1,0) and therefore returns ‘2’.

For more information, see HIVE-13945.