Data Types
Impala supports a set of data types that you can use for table columns, expression values, and function arguments and return values.
Note: Currently, Impala supports only scalar types, not composite or nested types. Accessing a table containing any columns with unsupported types causes an error.
For the notation to write literals of each of these data types, see Literals.
Impala supports a limited set of implicit casts to avoid undesired results from unexpected casting behavior.
- Impala does not implicitly cast between string and numeric or Boolean types. Always use
CAST()
for these conversions. - Impala does perform implicit casts among the numeric types, when going from a smaller or less precise type to a larger or more precise one. For example, Impala will implicitly convert a
SMALLINT
to aBIGINT
orFLOAT
, but to convert fromDOUBLE
toFLOAT
orINT
toTINYINT
requires a call toCAST()
in the query. - Impala does perform implicit casts from
STRING
toTIMESTAMP
. Impala has a restricted set of literal formats for theTIMESTAMP
data type and theFROM_UNIXTIME()
format string; see TIMESTAMP Data Type for details.
See the topics under this section for full details on implicit and explicit casting for each data type, and see Impala Type Conversion Functions for details about the CAST()
function.
Parent topic: Impala SQL Language Reference