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

------------------------------------------------------------------------------
  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.
+ If the operator is an arithmetic operator (+, -, *, /, etc), and the types of 
operands are different, then STRING will be converted to DOUBLE, and then we 
will convert the 2 operands to the same type, by choosing the type with higher 
precision.
  
- If the operator is a comparison 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.
+ If the operator is a comparison operator (=, <>, >, <, etc), and the types of 
operands are different, then STRING will be converted to DOUBLE, and then we 
will convert the 2 operands to the same type, by choosing the type with higher 
precision.
  
  Otherwise, the operator is probably a UDF/UDAF function.  In that case, we 
will try to convert the parameters to the types that are accepted by the 
UDF/UDAF function.
  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.

Reply via email to