Datatypes in apache hive

By | April 17, 2017

Datatypes in apache hive

What are the most common datatypes we used in apache hive, in this tutorial you will find the list of datatypes that are most common in use!

Hive supports Primitive Data Types

TINYINT

It’s a 1 byte integer.

SMALLINT

It’s a 2 byte integer

INT

It’s a 4 byte integer

BIGINT

It’s a 8 byte integer

BOOLEAN

This is either TRUE or FALSE

FLOAT

It’s a floating point number example – 9.9999

DOUBLE

It’s again double floating number – 9.9999

STRING

It’s a most commonly used and most popular datatype in hive, it’s a sequence of character and both single and double quoted string is supported in hive.

TIMESTAMP

Time stamp is support from version 8 onwards, mostly JDBC date format YYYY-MM-DD hh:mm:ss.fffffffff

BINARY

This is also a new datatype supported from hive version 8 onwards, it basically stores array of bytes data.




There are some other complex datatypes also supported by hive like

STRUCT

It’s a similar like C STRUCT and fields can be access using dot notation

MAP

It is useful in storing key value pair data. We called it is a collection of key-value tuples.

ARRAY

Arrays are sequence of same types that is it can be string array or integer array, first value of this array is starts with zero-based index.

RECOMMENDED BOOK: PROGRAMMING HIVE