'<Issue> Float data type in Hive

Init data:

CREATE TABLE `test.test_data`(
    user VARCHAR(10),
    amount FLOAT) 
TBLPROPERTIES ('transactional'='true');
INSERT INTO `test.test_data`
SELECT 'sonnh', 300000000000
UNION ALL
SELECT 'sonnh1', 1000000000000
UNION ALL
SELECT 'sonnh2', 900000000000;

Get data:

SELECT * FROM `test.test_data`

Results:

test.test_data.user    test.test_data.amount
sonnh                  299999986000
sonnh1                 1000000000000
sonnh2                 899999990000

I have a problem when use float data type like above. Someone explain it to me.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source