0

Hive support only one precision after decimal point. Can we change the precision value of float in hive? If not can we override the hive float function.

Ex: Hive support float as below
    create table test(amount float);
    amount 
    ------
    100.0
Expectation :
    create table test(amount float(10,4));
    amount
    ------
    10000.0000

But hive float does not support the precision value more than one. How can I change the precision value for float ? Any Hive UDF ? I know hive has decimal/double for more precision values. But we require float to support more precisions.

Any suggestions would be great help.

marjun
  • 696
  • 5
  • 17
  • 30
  • Please stop this nonsense: Hive FLOAT is based on the Java `float` which follows the IEEE standard, like any "float" or "real" implementation in the last 40 years. `100` is an **integer**, Hive just shows 1 decimal to make it explicit that it's a FLOAT and not an INT. Just try with `123.456` and see what happens. – Samson Scharfrichter Jan 23 '17 at 18:16
  • And **the SQL standard claims that FLOAT and DOUBLE are floating point datatypes, whereas the fixed point datatype is DECIMAL(p,s)** – Samson Scharfrichter Jan 23 '17 at 18:18
  • *"we require float to support more precisions"* -- you might just say "we require pigs to lay eggs". They were not designed for that. – Samson Scharfrichter Jan 23 '17 at 18:19

0 Answers0