hadoop上ORC压缩格式的使用
drop table test_tb_log_orc;
create table test_tb_log_orc ( all string )
stored as ORC;
默认是tblproperties("orc.compress"="ZLIB");
show create table test_tb_log_orc;
hadoop上gz压缩格式文件的使用
1) gz格式文件导入到外部表:external table for gz
drop table tmp_gz;
CREATE EXTERNAL TABLE tmp_gz( all string )
location'/user/test/'
insert overwrite table test_orc
select *
from tmp_gz
hadoop fs -ls/user/pmp_bi/test/testlog2
hadoop fs -ls/hivedata/warehouse/test.db/test_orc
2)从本地加载gz格式文件: load gz from local,通过一个临时表加载到外部表
耗时与put到云上建外部表一样
hive直接load
drop table tmp_gz;
CREATE TABLE tmp_gz( all string );
LOAD DATA LOCAL INPATH '/home/hadoop/filename.gz' OVERWRITE INTO TABLE tmp_gz;
insert overwrite table test_orc
select *
from tmp_gz
本地load是简单的
将gz文件put到内部表路径下即可。
如:/hivedata/warehouse/test.db/filename.gz
这种方式与hadoop直接put上次的耗时是一样的。
閱讀更多 熱忱先生 的文章