O'Reilly logo

Apache Hive Essentials by Dayong Du

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Data type conversions

Similar to Java, Hive supports both implicit type conversion and explicit type conversion.

Primitive type conversion from a narrow to a wider type is known as implicit conversion. However, the reverse conversion is not allowed. All the integral numeric types, FLOAT, and STRING can be implicitly converted to DOUBLE, and TINYINT, SMALLINT, and INT can all be converted to FLOAT. BOOLEAN types cannot be converted to any other type. In the Apache Hive wiki, there is a data type cross table describing the allowed implicit conversion between every two types in Hive and this can be found at https://cwiki.apache.org/confluence/display/Hive/LanguageManual+Types.

Explicit type conversion is using the CAST function with the CAST(value ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required