Using numeric data types

Hive supports a set of data types that can be used for table columns, expression values, and function arguments, and return values.

In the following table, primitive numeric data types are listed with sizes and examples:

Data Type

Size

Example

TINYINT

1-byte signed integer

50

SMALLINT

2-byte signed integer

20,000

INT

4-byte signed integer

1,000

BIGINT

8-byte signed integer

50,000

FLOAT

4-byte single-precision floating point

400.50

DOUBLE

8-byte double-precision floating point

20,000.50

DECIMAL

17-byte precision up to 38 digits

DECIMAL(20,2)

By default, all integral literals are treated as the INT values until they cross the range of INT values. If some integral literal crosses the range of the INT ...

Get Apache Hive Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.