Hive datatype mappings

Hive meaning Teradata meaning .net BCL Type
TINYINT
1-byte signed integer, from -128 to 127 ByteInt Represents a 8-bit (1-byte) signed integer.
Range: -128 to 127
System.Int16
SMALLINT  2-byte signed integer, from -32,768 to 32,767  SmallInt Represents a 16-bit (2-Byte) signed integer.
Range: -32,768 to 32,767
 System.Int16
INT/INTEGER  4-byte signed integer, from -2,147,483,648 to 2,147,483,647  Integer  Represents a 32-bit (4-byte) signed integer.
Range:  -2,147,483,648 to 2,147,483,647.
 System.Int32
BIGINT
8-byte signed integer, from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 BigInt Represents an 64-bit (8-byte) signed integer.
Range: -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807
System.Int64
FLOAT  4-byte single precision floating point number
DECIMAL
  • Introduced in Hive 0.11.0 with a precision of 38 digits
  • Hive 0.13.0 introduced user definable precision and scale
Decimal Represents a decimal number with maximum precision of 38 but it can range from 1 to 38. The scale can range from 0 to 38 but it must be less than or equal to the precision. System.Decimal
DOUBLE 8-byte double precision floating point number Double Represents a 64-bit double-precision number.
Range: ±2.226 x 10-308 to ±1.797 x 10308
System.Double
DOUBLE PRECISION alias for DOUBLE, only available starting with Hive 2.2.0
Number Represents a fixed or floating point decimal.

For fixed decimals the maximum precision is 38 and the scale can range from 0 to 38. The scale must be less than or equal to the precision.

For floating decimals the mantissa can contain up to 38 digits, and the exponent can range from -130 to 125.

System.Double
TIMESTAMP Note: Only available starting with Hive 0.8.0
 DATE Note: Only available starting with Hive 0.12.0
 INTERVAL Note: Only available starting with Hive 1.2.0
 STRING
 VARCHAR Note: Only available starting with Hive 0.12.0
 CHAR Note: Only available starting with Hive 0.13.0
BOOLEAN
BINARY Note: Only available starting with Hive 0.8.0
 arrays: ARRAY<data_type> Note: negative values and non-constant expressions are allowed as of Hive 0.14.
 maps: MAP<primitive_type, data_type> Note: negative values and non-constant expressions are allowed as of Hive 0.14.
 structs: STRUCT<col_name : data_type [COMMENT col_comment], …>
 union: UNIONTYPE<data_type, data_type, …>  Note: Only available starting with Hive 0.7.0.

 

 

Resources

  1. https://cwiki.apache.org/confluence/display/Hive/LanguageManual+Types
  2. https://developer.teradata.com/doc/connectivity/tdnetdp/15.11/help/NumericTypesOverview.html

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *