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 |
---|---|---|
|
1-byte signed integer |
50 |
|
2-byte signed integer |
20,000 |
|
4-byte signed integer |
1,000 |
|
8-byte signed integer |
50,000 |
|
4-byte single-precision floating point |
400.50 |
|
8-byte double-precision floating point |
20,000.50 |
|
17-byte precision up to 38 digits |
|
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
value, then it is treated as the BIGINT
value. There is a mechanism of postfix, which is used to specify an integral literal as TINYINT
, SMALLINT
, and BIGINT
.
To specify an integral literal as TINYINT
, the postfix Y
is used. For example, you can specify...