1.array文本批量导入和数据插入
1.1数据准备
1,zhangsan,唱歌-跳舞-游泳
2,lishi,打游戏-唱歌-篮球
1.2表的创建
create table t_arr(id int,name string,hobby array<string>)
row format delimited
fields terminated by ',' --字段以逗号终止
collection items terminated by '-'; --字符串符号分割
1.3数据导入
load data local inpath '/root/txt/array.txt' into table t_arr;
1.4数据插入
insert into table t_arr select 3,'xm',array('

本文介绍了如何在Hive中进行array、map和struct类型的数据批量导入。详细讲解了从文本数据到array的导入、使用str_to_map函数处理map数据的插入,以及运用named_struct进行struct数据的导入操作。每个步骤包括数据准备、表创建、数据导入和数据插入等环节,提供了一站式的解决方案。
最低0.47元/天 解锁文章
494

被折叠的 条评论
为什么被折叠?



