Friday, August 16, 2019

HIVE Data Types

Hive data types are categorized in numeric types, string types, misc types, and complex types. A list of Hive data types is given below.

Integer Types

TypeSizeRange
TINYINT1-byte signed integer-128 to 127
SMALLINT2-byte signed integer32,768 to 32,767
INT4-byte signed integer2,147,483,648 to 2,147,483,647
BIGINT8-byte signed integer-9,223,372,036,854,775,808 to 9,223,372,036,854,775,807

Decimal Type

TypeSizeRange
FLOAT4-byteSingle precision floating point number
DOUBLE8-byteDouble precision floating point number

Date/Time Types

TIMESTAMP
  • It supports traditional UNIX timestamp with optional nanosecond precision.
  • As Integer numeric type, it is interpreted as UNIX timestamp in seconds.
  • As Floating point numeric type, it is interpreted as UNIX timestamp in seconds with decimal precision.
  • As string, it follows java.sql.Timestamp format "YYYY-MM-DD HH:MM:SS.fffffffff" (9 decimal place precision)
DATES

The Date value is used to specify a particular year, month and day, in the form YYYY--MM--DD. However, it didn't provide the time of the day. The range of Date type lies between 0000--01--01 to 9999--12--31.

String Types

STRING
The string is a sequence of characters. It values can be enclosed within single quotes (') or double quotes (").
Varchar
The varchar is a variable length type whose range lies between 1 and 65535, which specifies that the maximum number of characters allowed in the character string.
CHAR
The char is a fixed-length type whose maximum length is fixed at 255.

Complex Type

TypeSizeRange
StructIt is similar to C struct or an object where fields are accessed using the "dot" notation.struct('James','Roy')
MapIt contains the key-value tuples where the fields are accessed using array notation.map('first','James','last','Roy')
ArrayIt is a collection of similar type of values that indexable using zero-based integers.array('James','Roy')


No comments:

Post a Comment

Lab 09: Publish and subscribe to Event Grid events

  Microsoft Azure user interface Given the dynamic nature of Microsoft cloud tools, you might experience Azure UI changes that occur after t...