You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues-all@impala.apache.org by "Tim Armstrong (JIRA)" <ji...@apache.org> on 2018/11/23 19:48:00 UTC

[jira] [Resolved] (IMPALA-7884) double values not getting loaded correctly in impala

     [ https://issues.apache.org/jira/browse/IMPALA-7884?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Tim Armstrong resolved IMPALA-7884.
-----------------------------------
    Resolution: Not A Bug

The DOUBLE type can't exactly represent many decimal values because it's a double-precision floating point number (see https://en.wikipedia.org/wiki/Floating-point_arithmetic#Representable_numbers,_conversion_and_rounding). If you use a decimal literal in an Impala query it will be converted to the nearest DOUBLE value. Then when it's returned it needs to be converted to a decimal representation. Different clients will use different rounding algorithms so you'll get different results.

We have a DECIMAL type that's designed for doing exact calculations on decimal numbers, e.g. for financial calculations:
https://impala.apache.org/docs/build/html/topics/impala_decimal.html

> double values not getting loaded correctly in impala
> ----------------------------------------------------
>
>                 Key: IMPALA-7884
>                 URL: https://issues.apache.org/jira/browse/IMPALA-7884
>             Project: IMPALA
>          Issue Type: Bug
>          Components: Frontend
>         Environment: impala
>            Reporter: prasad
>            Priority: Major
>
>  
> I have created a simple table in impala like below
>  
> {{ CREATE TABLE IF NOT EXISTS my_db.employee (name STRING, salary double );}}
> And my insert statement is like below
>  
> {{insert into employee (name,salary) VALUES ("Prasad",158.17)}}
> But the problem is
> My values in impala is getting loaded as
> {{name,salary }}
> {{prasad,158.1666666666}}
> {{ I dont understand why this is happening. I have tried in other db's like hive but the value is getting loaded as 158.17 but in impala it is 158.1666666666}}
> Can you please help me why this is happening ...
> And how to load actual values...
> Please guide me
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-all-unsubscribe@impala.apache.org
For additional commands, e-mail: issues-all-help@impala.apache.org