其他分享
首页 > 其他分享> > hive建表分隔符

hive建表分隔符

作者:互联网

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

collection items terminated by 设置一个复杂类型(array,struct)字段的各个item之间的分隔符

map keys terminated by  设置一个复杂类型(Map)字段的key value之间的分隔符

lines terminated by 设置行与行之间的分隔符

数据如下

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 ':'

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

标签:terminated,建表,map,mother,father,hive,字段,分隔符
来源: https://www.cnblogs.com/weijia-home/p/16535146.html