SMALLINT Data Type
A 2-byte integer data type used in
CREATE TABLE and
ALTER TABLE statements.
In the column definition of a
CREATE TABLE statement:
Range: -32768 .. 32767. There is no
Conversions: Impala automatically converts to a larger integer type (
BIGINT) or a floating-point type (
CAST() to convert to
Casting an integer or floating-point value
TIMESTAMP produces a value that is
N seconds past the start of the epoch
date (January 1, 1970). By default, the result value represents a date and time in the UTC time zone.
If the setting
--use_local_tz_for_unix_timestamp_conversions=true is in effect,
TIMESTAMP represents a date and time in the local time zone.
For a convenient and automated way to check the bounds of the
SMALLINT type, call the
If an integer value is too large to be represented as a
SMALLINT, use an
NULL considerations: Casting any non-numeric value to this type produces a
CREATE TABLE t1 (x SMALLINT); SELECT CAST(1000 AS SMALLINT);
Physically, Parquet files represent
SMALLINT values as 32-bit
integers. Although Impala rejects attempts to insert out-of-range values into such columns, if you create a
new table with the
CREATE TABLE ... LIKE PARQUET syntax, any
SMALLINT columns in the original table turn into
INT columns in the new
Partitioning: Prefer to use this type for a partition key column. Impala can process the numeric
type more efficiently than a
STRING representation of the value.
HBase considerations: This data type is fully compatible with HBase tables.
Text table considerations: Values of this type are potentially larger in text tables than in tables using Parquet or other binary formats.
Internal details: Represented in memory as a 2-byte value.
Added in: Available in all versions of Impala.
Column statistics considerations: Because this type has a fixed size, the maximum and average size
fields are always filled in for column statistics, even before you run the