Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Document column types + timestamp

Hive Data Types

Table of Contents

Column types

These are all the supported column types in Hive:

Primitive types:

  • TINYINT
  • SMALLINT
  • INT
  • BIGINT
  • BOOLEAN
  • FLOAT
  • DOUBLE
  • STRING
  • TIMESTAMP (Note: Only available starting with Hive 0.8.0)

Complex types:

  • arrays: ARRAY<data_type>
  • maps: MAP<primitive_type, data_type>
  • Wiki Markup
    structs: {{STRUCT <col_name : data_type \[COMMENT col_comment], ...>}}

Timestamps

Supports traditional UNIX timestamp with optional nanosecond precision.

Supported conversions:

  • Integer numeric types: Interpreted as UNIX timestamp in seconds
  • Floating point numeric types: Intepreted as UNIX timestamp in seconds with decimal precision
  • Strings: JDBC compliant java.sql.Timestamp format "YYYY-MM-DD HH:MM:SS.fffffffff" (9 decimal place precision)

Timestamps are interpreted to be timezoneless and stored as an offset from the UNIX epoch. Convenience UDFs for conversion to and from timezones are provided (to_utc_timestamp, from_utc_timestamp).
All existing datetime UDFs (month, day, year, hour, etc.) work with the TIMESTAMP data type.

Literals

Integral types

Integral literals are assumed to be INT by default, unless the number exceeds the range of INT in which case it is interpreted as a BIGINT, or if one of the following postfixes is present on the number.

...