hive - How to insert infinity in Impala Table -
how insert infinity , nan in impala. same test works hive throwing error in impala.
> create table z2 (x double); > insert z2 values (1),("nan"),("infinity"),("-infinity"); query: insert z1 values (1),("nan"),("infinity"),("-infinity") error: analysisexception: incompatible return types 'tinyint' , 'string' of exprs '1' , ''nan''.
can tell me how fix impala.
based on impala mathematical functions, you're missing cast(x double)
.
infinity , nan can specified in text data files inf , nan respectively, , impala interprets them these special values. can produced arithmetic expressions; example, 1/0 returns infinity , pow(-1, 0.5) returns nan. or can cast literal values, such cast('nan' double) or cast('inf' double).
so insert should read:
> insert z2 values (1), (cast ('nan' double)), (cast ('inf' double)), (- cast ('inf' double));
then you'll see:
> select * z2; +-----------+ | x | +-----------+ | 1 | | nan | | infinity | | -infinity | +-----------+ fetched 4 row(s) in 0.12s
Comments
Post a Comment