...
- arrays:
ARRAY<data_type>
(Note: negative values and non-constant expressions are allowed as of Hive 0.14.) - maps:
MAP<primitive_type, data_type>
(Note: negative values and non-constant expressions are allowed as of Hive 0.14.) - structs:
STRUCT<col_name : data_type [COMMENT col_comment], ...>
- union:
UNIONTYPE<data_type, data_type, ...>
(Note: Only available starting with Hive 0.7.0.)
Column Types
Integral Types (TINYINT
, SMALLINT
, INT
, BIGINT
)
Anchor | ||||
---|---|---|---|---|
|
Anchor | ||||
---|---|---|---|---|
|
Anchor | ||||
---|---|---|---|---|
|
Anchor | ||||
---|---|---|---|---|
|
Column Types
Integral Types (TINYINT
, SMALLINT
, INT
, BIGINT
)
Integral literals are assumed to be INT
by default, unless the number exceeds the range of INT
in which case it is interpreted as a BIGINT, or if one of the following postfixes is present on the number.
Type | Postfix | Example |
---|---|---|
TINYINT | Y | 100Y |
SMALLINT | S | 100S |
BIGINT | L | 100L |
...
Anchor | ||||
---|---|---|---|---|
|
Strings
String literals can be expressed with either single quotes (') or double quotes ("). Hive uses C-style escaping within the strings.
...
Anchor | ||||
---|---|---|---|---|
|
Varchar
Varchar types are created with a length specifier (between 1 and 65355), which defines the maximum number of characters allowed in the character string. If a string value being converted/assigned to a varchar value exceeds the length specifier, the string is silently truncated. Character length is determined by the number of code points contained by the character string.
...
Info | ||
---|---|---|
| ||
Varchar datatype was introduced in Hive 0.12.0 (HIVE-4844). |
...
Anchor | ||||
---|---|---|---|---|
|
Char
Char types are similar to Varchar but they are fixed-length meaning that values shorter than the specified length value are padded with spaces but trailing spaces are not important during comparisons. The maximum length is fixed at 255.
...
Info | ||
---|---|---|
| ||
Char datatype will be introduced in Hive 0.13.0 (HIVE-5191). |
...
Anchor | ||||
---|---|---|---|---|
|
Timestamps
Supports traditional UNIX timestamp with optional nanosecond precision.
...
Info | ||
---|---|---|
| ||
Timestamps were introduced in Hive 0.8.0 (HIVE-2272). |
Anchor date date
Dates
DATE
values describe a particular year/month/day, in the form YYYY-MM-DD
. For
example, DATE '2013-01-01'. Date types do not have a time of day component.
The range of values supported for the Date type is be 0000-01-01 to 9999-12-31, dependent on
support by the primitive Java Date type.
...