About

Type conversion is called generally “coercion.”

Coercion is the fact to change:

Function

The function name to coerce can be:

  • cast
  • coerce

Form

Implicit vs Explicit

Implicit (silent)

Silent coercions can make debugging a broken program particularly frustrating, since they cover up errors and make them harder to diagnose.

The hierarchy of type defines how the types are implicitly converted. Implicit conversion is allowed for types from child to an ancestor. Example of Hierarchy for Hive:

Primitive Type > Number > DOUBLE > FLOAT > BIGINT > INT > SMALLINT > TINYINT
                                 > STRING
               >BOOLEAN

Note that the type hierarchy allows the implicit conversion of STRING to DOUBLE.