What are the operation methods of hadoop compound type construction
This article mainly explains "what are the operation methods of hadoop compound type construction". Interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Next let the editor to take you to learn "what are the operation methods of hadoop compound type construction"?
1. Map type construction: map
Syntax: map (key1, value1, key2, value2, …)
Description: build the map type based on the input key and value pairs
For example:
Hive > Create table lxw_test as select map ('100th and 2000s) as t from lxw_dual
Hive > describe lxw_test
T map
Hive > select t from lxw_test
{"100,200": "tom", "200": "mary"}
2. Struct type construction: struct
Syntax: struct (val1, val2, val3, …)
Description: build the structure struct type according to the input parameters
For example:
Hive > create table lxw_test as select struct ('tom','mary','tim') as t from lxw_dual
Hive > describe lxw_test
T struct
Hive > select t from lxw_test
{"col1": "tom", "col2": "mary", "col3": "tim"}
3. Array type construction: array
Syntax: array (val1, val2, …)
Description: build an array array type based on the input parameters
For example:
Hive > create table lxw_test as selectarray ("tom", "mary", "tim") as t from lxw_dual
Hive > describe lxw_test
T array
Hive > select t from lxw_test
["tom", "mary", "tim"]
At this point, I believe you have a deeper understanding of "what are the operational methods for building hadoop composite types?" you might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!