Database Reference
In-Depth Information
MINUTE
,
MONTH
,
SECOND
,
TO_UTC_TIMESTAMP
,
UNIX_TIMESTAMP
, and
WEEKOFYEAR
.
The type conversion function
For type conversion, Impala uses the
CAST()
function within strict rules regarding
data types for functional parameters. The
CAST()
function is mostly used in conjunc-
tion with other SQL statements with other functions to explicitly pass the desired data
types. The syntax for using the
CAST
operator is shown in the following example:
CAST (expression as TYPE)
SELECT CONCAT ('Today is ', 28 , 'October.');
The previous SQL statement will generate an error as
28
is used as a numeric value,
and the
CONCAT
function only accepts string values. So we can use the
CAST
oper-
ator to convert numeric to
STRING
values as follows:
SELECT CONCAT ('Today is ', CAST(28 as STRING)
, 'October.');
I have previously suggested that most of the functions are described in the SQL doc-
umentation, so you can look at specific SQL documentation to learn more about Im-
pala built-in functions.