Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Document HIVE-3976

...

  • TINYINT (1-byte signed integer, from -128 to 127)
  • SMALLINT (2-byte signed integer, from -32,768 to 32,767)
  • INT (4-byte signed integer, from -2,147,483,648 to 2,147,483,647)
  • BIGINT (8-byte signed integer, from -9,223,372,036,854,775,808 to 9,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
    • Introduced in Hive 0.11.0 with a precision of 38 digits
    • Hive 0.
    11)
    • introduced user definable precision and scale

Date/Time Types

...

Decimals

Anchor
decimal
decimal

Info
titleVersion

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
sql
sql

CREATE TABLE foo (
  a DECIMAL,
  b DECIMAL(9, 7)
)

The Decimal datatype is discussed further in Floating Point Types below.

...

titleVersion

...

.

Union Types

Anchor
union
union

...