Book Image

Mastering Hadoop

By : Sandeep Karanth
Book Image

Mastering Hadoop

By: Sandeep Karanth

Overview of this book

Table of Contents (21 chapters)
Mastering Hadoop
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Index

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 as STRUCT {x INT, y STRING} can be accessed as A.x or A.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...