美文网首页
hive数据文件存储格式

hive数据文件存储格式

作者: 夜空痕 | 来源:发表于2019-11-01 16:10 被阅读0次

    在hive中有数据存储文件格式有四种,在此主要介绍ORCFile:

    • 列式存储ORCFile
      存储方式:数据按行分块,按照列存储,ORCFile存储,查询效率是最高的,hive/spark均支持
      创建方式:
          create table page_views_orc(
              ...
          )
          ROW FORMAT DELIMITED FIELDS TERMINATED BY '\t'
          STORED AS orc 
          LOCATION 'path';
      
      存储为ORC格式,但使用snappy压缩:
          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

    相关文章

      网友评论

          本文标题:hive数据文件存储格式

          本文链接:https://www.haomeiwen.com/subject/rkxqbctx.html