Data types
Hive supports all the primitive numeric data types such as TINYINT
, SMALLINT
, INT
, BIGINT
, FLOAT
, DOUBLE
, and DECIMAL
. In addition to these primitive data types, Hive also supports string types such as CHAR
, VARCHAR
, and STRING
data types. Like SQL, the time indicator data types such as TIMESTAMP
and DATE
are present. BOOLEAN
and BINARY
miscellaneous types are available too.
A number of complex types are also available. Complex types can be composed from other primitive or complex types. The complex types available are as follows:
STRUCTS
: These are groupings of data elements similar to a C-struct. The dot notation is used to dereference elements within a struct. A field within column C defined asSTRUCT {x INT, y STRING}
can be accessed asA.x
orA.y
.The syntax for this is
STRUCT<field_name : data_type>
MAPS
: These are key-value data types; providing the key within square braces can access a value. A value of a map column M that maps from key x to value y can be accessed...