hive中一共有以下几种建表方式:
create table person
(
id int,
name string,
hobbies array<string>,
address map<string,string>
)
row format delimited
fields terminated by ',';
collection items terminated by '-';
map keys terminated by ':';
创建外部表:
create external table person
(
id int,
name string,
hobbies array<string>,
address map<string,string>
)
row format delimited
fields terminated by ',';
collection items terminated by '-';
map keys terminated by ':';
location '/root/date/person'
根据已有的表创建表:
create table person1 as select id, name, hobbies, address from person0
like创建表:
create table person1 like person0
加载数据:
lo