Database Reference
In-Depth Information
The
CAST()
function can be use to convert
DOUBLE
values to
FLOAT
,
TINYINT
,
SMALLINT
,
INT
,
BIGINT
,
STRING
,
TIMESTAMP
, or
BOOLEAN
.
Exponential notation in DOUBLE literals can be used when casting from
STRING.
As an example, value 1.0e6 represents one million.
•
FLOAT
: A
FLOAT
data type in Impala represents a 4-byte single precision
floating-point data type when used with the
CREATE TABLE
or
ALTER
TABLE
statement. The value of
DOUBLE
in Impala ranges between
1.40129846432481707e-45 and 3.40282346638528860e+38, and this value
can either be positive or negative.
Casting with the
FLOAT
data type works as follows in Impala:
Impala automatically converts FLOAT to a more precise DOUBLE value but
not from DOUBLE to FLOAT.
For converting
FLOAT
to other data types, you can use the
CAST()
function
and the result will be any one of the
TINYINT
,
SMALLINT
,
INT
,
BIGINT
,
STRING
,
TIMESTAMP
, or
BOOLEAN
data types.
Exponential notations can be use in
FLOAT
when needed. Exponential liter-
als can also be used when casting from
STRING
; as an example 1.0e6 rep-
resents one million.
•
STRING
: A
STRING
data type holds a maximum of 32767 bytes of data in it
when used with the
CREATE TABLE
or
ALTER TABLE
statements. Here are
the key features of using the
STRING
data type:
• It is suggested that you limit the string values to the ASCII character
set for full support.
• Multibyte characters can also be used; however, their application will
be limited to query operations. String manipulation, comparison oper-
ators, and the
ORDER BY
clause may not function correctly with mult-
ibyte characters in the
STRING
data type.