hive中其它存储格式的数据导入

1、orc存储格式的表的创建

create table if not exists test(
name string,
num double,
born timestamp
)
row format delimited
fields terminated by ‘\t’
stored as orc
tblproperties(“orc.compress” = “snappy”);

压缩格式有两种:snappy和zlib

2、数据的插入

①单条插入或者从其它表插入
insert into test(name,num,born) values(’’, ,’’);
insert into test select * from other_table;

复制表结构:
create table A.test like B.test[ row format delimited fields terminated by ‘|’ ]
复制表结构及数据:(先复制表结构)
insert into test select * from B.test;

从txt文件插入:(test表以orc 为存储格式,other_table表以txt为存储格式);

存储格式为 ORC 的 hive 表,不能直接 load 文件,因为 ORC 格式的数据是有压缩操作的,并不是常规的格式。

可以先将txt文件load到hive表other_table中(还可以直接put到hdfs上的hive表),再使用①中的第二条语句进行操作。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值