Data Type Definition
Keyword
|
Hive Data Type
|
Description
|
Data Type Returned
|
---|---|---|---|
ARRAY<data-type>
|
An array of integers
(indexable lists).
|
||
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)
|
BINARY2
|
A varying length binary
string up to 32K.
|
BINARY
|
BOOLEAN
|
A textual true or false
value.
|
TINYINT
|
|
CHAR(n)
|
CHAR(n)2
|
A character string up
to 255 characters. 3
|
CHAR
|
DATE
|
An ANSI SQL date type.
|
DATE
|
|
DECIMAL/NUMERIC(p,s)
|
A fixed-point decimal
number, with 38 digits precision.
|
DOUBLE
|
|
DOUBLE
|
DOUBLE
|
An eight-byte, double-precision
floating-point number.
|
DOUBLE
|
FLOAT(p)
|
FLOAT
|
A four-byte, single-precision
floating-point number.
|
DOUBLE
|
INTEGER
|
INTEGER
|
A signed four-byte integer.
|
INTEGER
|
MAP<primitive-type, data-type>
|
An associative array
of key-value pairs.
|
||
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.
|
||
STRUCT<col-name: data-type>
|
A structure with established
column elements and data types. Column elements and data types are
mapped using a double-dot (:) notation.
|
||
TIME(p)
|
A time value.
|
STRING
|
|
TIMESTAMP(p)
|
TIMESTAMP
|
A UNIX timestamp with
optional nanosecond precision.
|
TIMESTAMP[(p)]
|
TINYINT
|
TINYINT
|
A signed one-byte integer,
from -128 to 127.
|
TINYINT
|
UNION<data-type, data-type-n>
|
A type that can hold
one of several specified data types.
|
||
VARCHAR(n)
|
VARCHAR(n)
|
A varying-length character
string.
|
VARCHAR(n)
|
VARBINARY
|
BINARY
|
A varying length binary
string up to 32K.
|
BINARY2
|
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 and DECIMAL types), columns defined as CHAR are mapped to VARCHAR. Columns that are defined as DECIMAL are not supported. In Hadoop environments that use Hive versions earlier than Hive 0.13, BINARY columns can be created but not retrieved. | |||
3If you specify CHAR with a value greater than 255 characters, the column is created as VARCHAR(n) instead. | |||
4Full 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. | |||
5The supported date values are between October 15, 1582 and December 31, 9999. Date values containing years earlier than 1582 will return an error. Date values later than 9999 will be read back as null values. | |||
6Decimals processed by SAS are processed using a DOUBLE, which can alter the precision. | |||
7The maximum length of VARCHAR(n) and the Hive complex types is determined by the DBMAX_TEXT= data source connection option. | |||
8SASFMT Table Properties are applied when reading STRING columns. | |||
9Hive does not support the TIME(p) data type. When data is read from Hive, STRING columns that have SASFMT TableProperties defined that specify the SAS TIME8. 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. Fractional seconds are not preserved. For more information about SASFMT TableProperties, see “SAS Table Properties for Hive and HADOOP” in SAS/ACCESS for Relational Databases: Reference. | |||
10The complex types ARRAY, MAP, STRUCT, and UNION are read as their STRING representation of the underlying complex type. ARRAY values are read back within brackets, for example: [1, 2, 4]. STRUCT and MAP values are read back within braces, for example: {"firstname":"robert","nickname":"bob"}. |