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

TINYINT Data Type

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

Range: -128 .. 127. There is no UNSIGNED subtype.

Conversions: Impala automatically converts to a larger integer type (SMALLINT, INT, or BIGINT) or a floating-point type (FLOAT or DOUBLE) automatically. Use CAST() to convert to 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 TINYINT);
SELECT CAST(100 AS TINYINT);

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, INT Data Type, BIGINT Data Type, SMALLINT Data Type, Mathematical Functions

Page generated September 3, 2015.