我是靠谱客的博主 老实棒球,这篇文章主要介绍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表),再使用①中的第二条语句进行操作。

最后

以上就是老实棒球最近收集整理的关于hive中其它存储格式的数据导入的全部内容,更多相关hive中其它存储格式内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(84)

评论列表共有 0 条评论

立即
投稿
返回
顶部