Database Reference
In-Depth Information
Using the
CAST()
operator,
SMALLINT
is converted to
TINYINT
,
STRING
,
or
TIMESTAMP
.
SMALLNT
conversion to
TIMESTAMP
also works with
INT
. While using
Cast()
with
SMALLINT N
to
TIMESTAMP
, the resulting value shows N
seconds past the start of the epoch date (January 1, 1970).
•
TINYINT
: In Impala,
TINYINT
represents a 1-byte integer type of data when
used with the
CREATE TABLE
or
ALTER TABLE
statement. The value of
TIYINT
in Impala ranges between -128 and 127, and there is no
UNSIGNED
subtype with
SMALLINT
.
Here is how Casting works with the
TINYINT
data type:
Impala automatically converts
TINYINT
to a larger integer date type
(
SMALLINT, INT
, or
BIGINT
) or a floating-point type (
FLOAT
or
DOUBLE
).
Using the
CAST()
operator,
SMALLINT
is converted to only
STRING
and
TIMESTAMP
.
TINYINT
conversion 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).
More information on the
INT
data type is available in mathematical functions
also.
•
DOUBLE
: A
DOUBLE
data type in Impala represents an 8-byte double,
precision, floating-point data type when used with the
CREATE TABLE
or
ALTER TABLE
statement. The value of
DOUBLE
in Impala ranges between
4.94065645841246544e-324d and 1.79769313486231570e+308, and this
value can either be positive or negative.
Casting with
DOUBLE
works, as follows, in Impala:
Impala does not automatically convert DOUBLE to any other type.