하이브는 다음과 같은 기본 데이터 유형 (primitive type) 과 복잡한 데이터 유형 (complex type)을 지원합니다. 이러한 데이터 유형은 테이블의 열(columns)과 연관이 있습니다.
data_type
: primitive_type
| array_type
| map_type
| struct_type
| union_type -- (Note: Available in Hive 0.7.0 and later)
primitive_type
: TINYINT
| SMALLINT
| INT
| BIGINT
| BOOLEAN
| FLOAT
| DOUBLE
| DOUBLE PRECISION -- (Note: Available in Hive 2.2.0 and later)
| STRING
| BINARY -- (Note: Available in Hive 0.8.0 and later)
| TIMESTAMP -- (Note: Available in Hive 0.8.0 and later)
| DECIMAL -- (Note: Available in Hive 0.11.0 and later)
| DECIMAL(precision, scale) -- (Note: Available in Hive 0.13.0 and later)
| DATE -- (Note: Available in Hive 0.12.0 and later)
| VARCHAR -- (Note: Available in Hive 0.12.0 and later)
| CHAR -- (Note: Available in Hive 0.13.0 and later)
array_type
: ARRAY < data_type >
map_type
: MAP < primitive_type, data_type >
struct_type
: STRUCT < col_name : data_type [COMMENT col_comment], ...>
union_type
: UNIONTYPE < data_type, data_type, ... > -- (Note: Available in Hive 0.7.0 and later)
Hive Misc Types (Boolean & Binary)
Hive Numeric Types
NUMERIC TYPES | DESCRIPTION |
---|---|
TINYINT | 1-byte signed integer, from -128 to 127 |
SMALLINT | 2-byte signed integer, from -32,768 to 32,767 |
INT/INTEGER | 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 |
DOUBLE PRECISIO N | Alias for DOUBLE, only available starting with Hive 2.2.0 |
DECIMAL | It accepts a precision of 38 digits. |
NUMERIC | Same as DECIMAL type. |
Hive String Types
STRING TYPES | DESCRIPTION |
---|---|
STRING | The string is an unbounded type. Not required to specify the lenght. It can accept max up to 32,767 bytes. |
VARCHAR | Variable length of characters. It is bounded meaning you still need to specify the length like VARCHAR(10). |
CHAR | Fixed length of Characters. if you define char(10) and assigning 5 chars, the remaining 5 characters space will be wasted. |
Hive Date & Time Types
Hive Complex Types (Array, Map, Struct)
- Spark와 마찬가지로 Hive는 Array, Map, Struct 및 union을 포함하는 복잡한 데이터 유형도 지원합니다.
- Array는 list of elements 을 저장하는 데 사용됩니다.
- Map은 key / value pair를 저장하는 데 사용됩니다.
- Struct는 부모 및 자식 연결을위한 것 입니다.
'ML Engineering > Hadoop and Hive' 카테고리의 다른 글
[Hive] 파일 포맷 (Storage Formats) (0) | 2021.05.23 |
---|---|
[Hive] 관리형(Managed) 테이블과 외부(External) 테이블 (0) | 2021.05.23 |
[Hive] Hive DDL Commands (0) | 2021.05.23 |
[Hive] Metastore, Datawarehouse (0) | 2021.05.23 |
[Hive] Apache Hive 란? (0) | 2021.05.23 |