I am using CDH 5.3.0 and Hive 0.12. I am having a Hive table with columns defined as double.
I am loading data to these double columns with 2 scale of precision after decimal point from a HDFS sequence file. For example, in my HDFS sequence file my data is like - 100.23 or 345.00. I need to choose double as my data value can be a big value like "3457894545.00"
My requirement is to display two scale precision after decimal point while querying to the Hive table. So with the example data, mentioned above, if i query for this column then I would need to see the value as "100.23" or "345.00".
But with Hive 0.12, I am getting only single precision after decimal point, i.e. value is getting truncated to "100.2" or "345.0".
I tried with "decimal" data type giving syntax as "decimal(3,2)" but in that case my value is getting completely rounded off i.e. "100" or "345".
I was goggling to see if there is any option to define custom precision to a double data type and found that custom precision can be given from hive 0.13 on wards.
Is Hive 0.12 double data type shows only single precision after decimal point. Do i need to apply any custom fix. Kindly suggests.
Thanks in advance.
You should declare as decimal(5,2).
The syntax is DECIMAL(precision, scale). Precision means the number of digits of this number including the digits after the dot.
Related
I am trying to publish data from our SAS environment into a remote Hadoop/Hive database (as sequence files). I'm performing basic tests by taking some source data from our business users and using a data step to write out to the Hadoop library.
I'm getting errors indicating that a value at row X is out of range.
For example:
ERROR: Value out of range for column BUY_RT1, type DECIMAL(5, 5). Disallowed value is: 0.
The source data has a numeric format of 6.5, and the actual value is .00000.
Why is .00000 out of range? Would the format for Hadoop need to be DECIMAL(6, 5)?
I get the same error when the value is 0.09:
ERROR: Value out of range for column INT_RT, type DECIMAL(5, 5). Disallowed value is: 0.09
You may need to check the actual values in SAS. If a numeric value in SAS has a format applied, you will see the formatted (possibly rounded) version of the numeric value wherever you output the value, but the underlying numeric may still have more significant digits that you're not seeing, due to the format.
For example, you say your source data has a format of 6.5 and the 'actual value' is 0.00000; are you sure that's the actual value? To check, you could try comparing the value to a literal 0, or putting the value to the SAS log with a different format like BEST32. (eg put BUY_RT1 best32.;).
If this is the problem, the solution is to properly round the source numeric values, rather than just applying a format.
I am trying to sum up a column of double type in hive. However the result is inconsistent. I am getting value like 136.0021 as output and on rerunning I am getting value as 136.0017. I can understand that we cant expect precision with double values. But my output is to be saved in hive table where the column is configured as double type.
Is there any approach to resolve this precision issue without updating column data type
I cast double values to decimal before performing addition. After addition I then cast result back to double and put it in hdfs.
I have some data in my hive table which have different number of tailing digits after decimal, I used decimal(precision,scale) function so that i can get data with two tailing digit after decimal.
for decimal(10,2) function-
input 123.123
output 123.12
but for input 123.1
output was 123.1 and i want it to be 123.10
How can i get data in my desired format.?
Tailing 0 after decimal getting trim for release prior to 0.14 in Hive. This issue is fixed in 0.14 release. Jira Id for reference :-
https://issues.apache.org/jira/browse/HIVE-7373
I would like to create a format in SAS, that converts float into text, e.g.
1.7 should be converted into 'one point seven'. Float contains three symbols only - a digit, a point and a digit.
I know this could be solved by creating data set containing all variations and then format based on this set, but it doesn't satisfy me at all.
I'am using JasperReport and ireport 4.0 , I want to know If their the possibility to create a table that can I fix lines and columns? Because the only the table that I have found allowed me just to fix columns !!
And
For the charts I have just an integer values but I dont know what the scale use float numbers!
Update:
what I mean that ireport allowed this format:
and I want the following format:
Thank you
Typically you have a varying number of rows, because the number of rows depend on the data from your database.
To have a known number of rows you either have to make sure that your data has the expected number of rows, or you design your detail section in a way that corresponds to your desired outcome. The height of the detail section is flexible, and you can put various text fields not only side by side, but also on top of each other.