Sponsored Links

Ad by Google
Apache Hive is a very demanding data warehouse in the market, and it's based on Hadoop infrastructure. Although all big data technologies are on demand but Hive is on highly demanded as compared to other big data technology. Apache Hive is data warehouse and sql like tool to process structure datasets. It was developed at Facebook and mainly used for data presentation phase. Hive syntax is very much similar to mysql database.
In this tutorial, I am going to list the data types supported by Apache Hive, and those are listed below with very simple example. It categories Hive data types into five different sub categories and those are-
Hive Data Types:
  • Numeric Types
  • Date and Time Types
  • String Types
  • Misc Types
  • Complex Types
Numeric Types:
  • TINYINT : 1 byte signed integer.
  • SMALLINT : 2 byte signed integer.
  • INT : 4 byte signed integer.
  • BIGINT : 8 byte signed integer.
  • FLOAT : 4 byte single precision floating point number.
  • DOUBLE :8 byte double precision floating point number.
  • DECIMAL : user definable precision and scale.

Date and Time:
  • DATE

String Types:
  • CHAR (create table t (alphabets char(2));)

Misc Types:

And below are the data types which makes Hive totally different from other traditional databases, known as complex data types in hive.
Complex Types:
  • array : Indexed based collection of similar type.
  • maps : Object(object contains different types of fields)
  • structs : Collection of Key-Value pair.
  • union : UNIONTYPE is a collection of heterogeneous data types.

create table hive_data_type_info
(id int,name string,
types array<string>,
detail_info map<string,string>,
committers struct<count:int,dt:date,name:string>,
other_info uniontype<float,boolean,string>) 
row format delimited
fields terminated by '\001'
collection items terminated by '\002'
map keys terminated by ':' 
stored as textfile;

That's it, to start with word count in hive you may like this and for the installation, hive installation guide.
Sponsored Links


Post a Comment