...
TINYINT
(1-byte signed integer, from-128
to127
)SMALLINT
(2-byte signed integer, from-32,768
to32,767
)INT
(4-byte signed integer, from-2,147,483,648
to2,147,483,647
)BIGINT
(8-byte signed integer, from-9,223,372,036,854,775,808
to9,223,372,036,854,775,807
)FLOAT
(4-byte single precision floating point number)DOUBLE
(8-byte double precision floating point number)DECIMAL
(Note: Only available starting with 11)- introduced user definable precision and scale
Date/Time Types
TIMESTAMP
(Note: Only available starting with Hive 0.8.0)DATE
(Note: Only available starting with Hive 0.12.0)
...
Decimals
Anchor | ||||
---|---|---|---|---|
|
Info | ||
---|---|---|
| ||
Decimal datatype was introduced in Hive 0.11.0 (HIVE-2693). |
The DECIMAL
type in Hive is based on Java's BigDecimal which is used for representing immutable arbitrary precision decimal numbers in Java. All regular number operations (e.g. +, -, *, /) and relevant UDFs (e.g. Floor, Ceil, Round, and many more) handle decimal types. You can cast to/from decimal types like you would do with other numeric types. The persistence format of the decimal type supports both scientific and non-scientific notation. Therefore, regardless of whether your dataset contains data like 1E+44 (scientific notation) or 4004 (non-scientific notation) or a combination of both, DECIMAL
can be used for it.
With the present Hive implementation, the Decimal type has precision Hive 0.11 and 0.12 have the precision of the DECIMAL
type fixed and limited to 38 digits. While this has minimal impact on usability, it's worth noting for performance reasons. HIVE-3796 is tracking the progress of allowing users to As of Hive 0.13 users can specify scale and precision when creating tables with decimal datatype.the DECIMAL
datatype using a DECIMAL(precision, scale)
syntax:
Code Block | ||||
---|---|---|---|---|
| ||||
CREATE TABLE foo (
a DECIMAL,
b DECIMAL(9, 7)
)
|
The Decimal datatype is discussed further in Floating Point Types below.
...
title | Version |
---|
...
.
Union Types
Anchor | ||||
---|---|---|---|---|
|
...