This is the documentation for CDH 5.1.x. Documentation for other versions is available at Cloudera Documentation.

SMALLINT Data Type

A 2-byte integer data type used in CREATE TABLE and ALTER TABLE statements.

Range: -32768 .. 32767. There is no UNSIGNED subtype.

Conversions: Impala automatically converts to a larger integer type (INT or BIGINT) or a floating-point type (FLOAT or DOUBLE) automatically. Use CAST() to convert to TINYINT, STRING, or TIMESTAMP. Casting an integer value N to TIMESTAMP produces a value that is N seconds past the start of the epoch date (January 1, 1970).

Examples:

CREATE TABLE t1 (x SMALLINT);
SELECT CAST(1000 AS SMALLINT);

Parquet considerations:

Physically, Parquet files represent TINYINT and 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 TINYINT or SMALLINT columns in the original table turn into INT columns in the new table.

Related information: Literals, TINYINT Data Type, BIGINT Data Type, TINYINT Data Type, INT Data Type, Mathematical Functions

Page generated September 3, 2015.