Which of the Following Data Type Is Supported by Hive?


Larry Thompson

When working with Hive, it is essential to understand the different data types that are supported. These data types allow for efficient storage and manipulation of data within the Hive environment. In this article, we will explore the various data types that are supported by Hive and how they can be used in your queries.

Data Types in Hive

Hive supports a wide range of data types, including:

  • BOOLEAN: This data type represents boolean values, which can be either true or false.
  • TINYINT: The TINYINT data type is used to store small integer values. It takes up 1 byte of storage and can hold values from -128 to 127.
  • SMALLINT: Similar to TINYINT, SMALLINT is used for storing small integer values. However, it takes up 2 bytes of storage and can hold values from -32,768 to 32,767.
  • INT: INT is used for storing integer values.

    It takes up 4 bytes of storage and can hold values from -2^31 to (2^31)-1.

  • BIGINT: BIGINT is used for storing large integer values. It takes up 8 bytes of storage and can hold values from -2^63 to (2^63)-1.
  • FLOAT: The FLOAT data type is used for storing single-precision floating-point numbers.
  • DOUBLE: DOUBLE is used for storing double-precision floating-point numbers with higher precision than FLOAT.
  • STRING: STRING represents character strings of variable length. It is one of the most commonly used data types in Hive.
  • CHAR: CHAR is used for storing fixed-length character strings.
  • VARCHAR: VARCHAR is similar to CHAR but allows for variable-length character strings.
  • DATE: The DATE data type represents a date in the format ‘YYYY-MM-DD’.
  • TIMESTAMP: TIMESTAMP is used for storing timestamps with date and time information.

Example Usage

To illustrate the usage of these data types, let’s consider an example. Suppose we have a table called “employees” with the following schema:

CREATE TABLE employees (
  id INT,
  name STRING,
  age TINYINT,
  salary DOUBLE

In this example, we are using various data types to store employee information. The “id” column uses the INT data type, “name” uses STRING, “age” uses TINYINT, and “salary” uses DOUBLE.

When inserting data into this table, you need to ensure that the values match the corresponding data types. For example:

INSERT INTO employees (id, name, age, salary)
VALUES (1, 'John Doe', 25, 50000.0);

In this INSERT statement, we are providing values that correspond to the defined data types in the table schema.


In conclusion, Hive supports a wide range of data types that can be used to efficiently store and manipulate data. Understanding these data types is crucial when working with Hive tables and writing queries. By using the appropriate data types for your columns, you can ensure accurate storage and retrieval of data within the Hive environment.

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

Privacy Policy