Type Conversion Functions
Impala supports the following type conversion functions:
- cast(expr as type)
Conversion functions are usually used in combination with other functions, to explicitly pass the expected data types. Impala has strict rules regarding data types for function parameters. For example, Impala does not automatically convert a DOUBLE value to FLOAT, a BIGINT value to INT, or other conversion where precision could be lost or overflow could occur. Use CAST when passing a column value or literal to a function that expects a parameter with a different type. For example:
select concat('Here are the first ',10,' results.'); -- Fails select concat('Here are the first ',cast(10 as string),' results.'); -- Succeeds
<< Mathematical Functions | Date and Time Functions >> | |