在hive中有数据存储文件格式有四种,在此主要介绍ORCFile:
-
列式存储ORCFile
存储方式:数据按行分块,按照列存储,ORCFile存储,查询效率是最高的,hive/spark均支持
创建方式:
存储为ORC格式,但使用snappy压缩:create table page_views_orc( ... ) ROW FORMAT DELIMITED FIELDS TERMINATED BY '\t' STORED AS orc LOCATION 'path';
create table page_views_orc_snappy( track_time string, url string, session_id string, referer string, ip string, end_user_id string, city_id string ) ROW FORMAT DELIMITED FIELDS TERMINATED BY '\t' STORED AS orc tblproperties ("orc.compress"="SNAPPY");
-
TestFile
存储方式:TextFile文件不支持块压缩,默认格式,数据不做压缩,磁盘开销大,数据解析开销大,实际生产中,均不采用此种方案
在实际的工作中,以列式存储为主ORCFile
网友评论