码出个世界

导航

hive建表分隔符

row format delimited fields terminated by  设置字段与字段之间的分隔符(字段与字段之间就是属性与属性之间,不是行与行之间,行的末尾)

collection items terminated by 集合(Map/Array/Struct)元素与元素之间的分隔符

map keys terminated by  Map 中的 key 与 value 之间的分隔符

lines terminated by 设置行与行之间的分隔符,默认为\n

数据如下

1,zhangsan,father:xiaoming#mother:xiaohuang#brother:xiaoxu,28

2,lisi,father:mayun#mother:huangyi#brother:guanyu,22

3,wangwu,father:wangjianlin#mother:ruhua#sister:jingtian,29

4,mayun,father:mayongzhen#mother:angelababy,26

建表

create table t_family(id int, name string, family_members map<string,string>, age int)

row format delimited fields terminated by ','

collection items terminated by '#'

map keys terminated by ':'

lines terminated by '\n';

 

 

load data local inpath '/home/map.txt' into table t_family;

 

posted on 2022-07-30 15:48  码出个世界  阅读(513)  评论(0)    收藏  举报