Dear Wiki user, You have subscribed to a wiki page or wiki category on "Hadoop Wiki" for change notification.
The following page has been changed by ZhengShao: http://wiki.apache.org/hadoop/Hive/HiveQL/Types ------------------------------------------------------------------------------ == Implicit and Explicit Type Conversions == In most cases, users don't need to care about the types because Hive is able to do implicit type conversions. - However there are some cases that user wants to explicitly convert the type. Please see + However there are some cases that user wants to explicitly convert the type. === Implicit Type Conversion Rules === If the operator is an arithmetic operator (+, -, *, /, etc), STRING will be converted to DOUBLE, and then we will make the 2 operands of the same type, by choosing the type with higher precision. @@ -62, +62 @@ If the UDF/UDAF function is overloaded (with more than 1 implementations with different types), we will try to find the one with least number of type conversions needed. If there are more than 1 with the same least number of type conversions, an error is thrown saying the query is ambiguous. In this case, it is necessary to explicitly convert the types. === Explicit Type Conversion Examples === + Users can use ''CAST'' to explicitly do type conversions. + {{{ CAST(1.5 AS INT) = 2 CAST(-1.5 AS INT) = -2
