Database Reference
In-Depth Information
Here is how Casting works with the
INT
data type:
Impala automatically converts the
INT
data type to a larger integer data type
(
BIGINT
) or a floating-point data type (
FLOAT
or
DOUBLE
).
You can use the
CAST()
operator to convert
INT
to
TINYINT
,
SMALLINT
,
STRING
, or
TIMESTAMP
.
You can also cast an
INT
value to
TIMESTAMP
. While using
Cast()
with
INT N
to
TIMESTAMP
, the resulting value shows N seconds past the start of
the epoch date (January 1, 1970).
•
BIGINT
: In Impala,
BIGINT
represents an 8-byte integer type of data when
used with the
CREATE TABLE
or
ALTER TABLE
statement. The value
of
BIGINT
in Impala ranges between -9223372036854775808 and
9223372036854775807, and there is no
UNSIGNED
subtype with
BIGINT
.
Here is how Casting works with the
BIGINT
data type:
Impala automatically converts
BIGINT
to a floating-point type (
FLOAT
or
DOUBLE
).
Using the
CAST()
operator,
BIGINT
is converted to
TINYINT
,
SMALLINT
,
INT
,
STRING
, or
TIMESTAMP
.
Conversion of
BIGINT
to
TIMESTAMP
also works as
INT
. While using
Cast()
with
BIGINT
N to
TIMESTAMP
, the resulting value shows N seconds
past the start of the epoch date (January 1, 1970).
•
SMALLINT
: In Impala,
SMALLINT
represents a 2-byte integer type of data
when used with the
CREATE TABLE
or
ALTER TABLE
statements. The value
of
SMALLINT
in Impala ranges between -32768 and 32767, and there is no
UNSIGNED
subtype with
SMALLINT
.
Here is how Casting works with the
SMALLINT
data type:
Impala automatically converts
SMALLINT
to a larger integer date type (
INT
or
BIGINT
) or a floating-point type (
FLOAT
or
DOUBLE
).