What Are the Data Type of Hive?


Larry Thompson

Data types in Hive are important for defining the structure and characteristics of the data stored in tables. Hive supports several data types, each with its own purpose and usage. In this article, we will explore the different data types available in Hive and understand their significance.

Primitive Data Types

Hive supports a variety of primitive data types, which are the building blocks for defining more complex data structures. Here are some commonly used primitive data types:

  • TINYINT: A 1-byte signed integer (-128 to 127).
  • SMALLINT: A 2-byte signed integer (-32,768 to 32,767).
  • INT: A 4-byte signed integer (-2,147,483,648 to 2,147,483,647).
  • BIGINT: An 8-byte signed integer (-9,223,372,036,854,775,808 to 9,223,372,036,854,775,807).
  • FLOAT: A single-precision floating-point number.
  • DOUBLE: A double-precision floating-point number.
  • BOOLEAN: A boolean value (true or false).
  • STRING: A sequence of characters.

Complex Data Types

In addition to the primitive data types mentioned above, Hive also provides support for complex data types. These data types allow you to work with structured and nested data. Let’s take a look at some commonly used complex data types:


An array is an ordered collection of elements of the same data type. In Hive, arrays can be defined using the ARRAY<data_type> syntax. For example, ARRAY<STRING> represents an array of strings.


A map is a collection of key-value pairs, where each key and value can be of different data types. In Hive, maps can be defined using the MAP<key_type, value_type> syntax. For example, MAP<STRING, INT> represents a map with string keys and integer values.


A struct is a collection of fields with each field having its own data type. In Hive, structs can be defined using the STRUCT<field1: data_type1, field2: data_type2,..> syntax. For example, STRUCT<name: STRING, age: INT> represents a struct with name and age fields.

Date and Time Data Types

Hive also provides support for date and time-related data types:

  • TIMESTAMP: Represents a specific point in time with nanosecond precision.
  • DATE: Represents a date without any time component.

User-Defined Data Types

In addition to the built-in data types, Hive allows you to define your own custom data types using the CREATE TYPE statement. This feature enables you to work with complex data structures tailored to your specific requirements.

In conclusion, understanding the different data types in Hive is crucial for effectively storing and manipulating data. Whether you are dealing with basic values or complex nested structures, Hive offers a wide range of data types to suit your needs.

Discord Server - Web Server - Private Server - DNS Server - Object-Oriented Programming - Scripting - Data Types - Data Structures

Privacy Policy