分享

hive符合类型的数据如何插入?比如数组

desehawk 2018-3-24 20:11:14 发表于 小知识点 [显示全部楼层] 回帖奖励 阅读模式 关闭右栏 0 10179
本帖最后由 pig2 于 2018-4-29 10:31 编辑
1、创建表时指定数组分隔形式
create table t_arr(id int,name string,hobby array<string>)
row format delimited
fields terminated by ','  --字段以逗号终止
collection items terminated by '-';  --字符串符号分割

2、批量导入
load data local inpath '/root/txt/array.txt' into table t_arr;

3、Insert单条插入
insert into table t_arr select 3,'xm',array('A','B','C') from t_b limit 1;

没找到任何评论,期待你打破沉寂

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关闭

推荐上一条 /2 下一条