Data Types for Hive

The following table lists the data type support for Hive. Hive versions 0.10 and later are supported.
The DECIMAL(p,s), NCHAR, NVARCHAR, and VARBINARY data types are not available for data definition.
Hive complex types are not supported.
For data-source specific information about Hive data types, see the Hive database documentation.
Data Types for Hive
Data Type Definition Keyword
Hive Data Type
Description
Data Type Returned
BIGINT
BIGINT
A signed eight-byte integer, from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807.
BIGINT
BINARY(n)
BINARY
A varying length binary string.
BINARY
BOOLEAN
A textual true or false value.
TINYINT
CHAR(n)
CHAR(n)2
A character string up to 255 characters.
CHAR
DATE
DATE34
An ANSI SQL date type.
DATE
DECIMAL/NUMERIC(p,s)
DECIMAL
A fixed-point decimal number, with 38 digits precision.
DOUBLE
DOUBLE
DOUBLE
An eight-byte, double-precision floating-point number.
DOUBLE
FLOAT(p)
FLOAT(p)
A four-byte, single-precision floating-point number.
FLOAT(p)
INTEGER
INTEGER
A signed four-byte integer.
INTEGER
REAL
DOUBLE
A 64-bit double precision, floating-point number.
DOUBLE
SMALLINT
SMALLINT
A signed two-byte integer, from -32,768 to 32,767.
SMALLINT
STRING
A variable-length character string.
VARCHAR(n)56
TIME(p)
A time value.
STRING7
TIMESTAMP(p)
TIMESTAMP
A UNIX timestamp with optional nanosecond precision.
TIMESTAMP[(p)]
TINYINT
TINYINT
A signed one-byte integer, from -128 to 127.
TINYINT
VARCHAR(n)
VARCHAR(n)
A varying-length character string.
VARCHAR(n)
1The Hive data type cannot be defined, and when data is retrieved, the native data type is mapped to a similar data type.
2Full support for this data type is available in Hive 0.13 and later. In Hadoop environments that use earlier Hive versions (which do not support the CHAR type), columns defined as CHAR are mapped to VARCHAR.
3Full support for this data type is available in Hive 0.12 and later. In Hadoop environments that use earlier Hive versions (which do not support the DATE type), any SASFMT TableProperties that are defined on STRING columns are applied when reading Hive, effectively allowing the STRING columns to be treated as DATE columns. When the DATE data type is used for data definition in earlier Hive versions, the DATE type is mapped to a STRING column with SASFMT TableProperties. For more information about SASFMT TableProperties, see “SAS Table Properties for Hive and HADOOP” in SAS/ACCESS for Relational Databases: Reference.
4Hive has a maximum year value of 9999. Date values containing higher years will be read back as null values.
5The maximum length of VARCHAR(n) is determined by the DBMAX_TEXT= data source connection option.
6SASFMT Table Properties are applied when reading STRING columns.
7Hive does not support the TIME(p) data type. When data is being read from Hive, STRING columns that have SASFMT TableProperties defined that specify the SAS DATE8. format are converted to the TIME(p) data type. When the TIME type is used for data definition, it is mapped to a STRING column with SASFMT TableProperties. For more information about SASFMT TableProperties, see “SAS Table Properties for Hive and HADOOP” in SAS/ACCESS for Relational Databases: Reference.