Hive的檔案存盤格式:
- textFile
textFile為默認格式
存盤方式:行存盤
缺點:磁盤開銷大;資料決議開銷大;壓縮的text檔案,hive無法進行合并和拆分
- sequencefile
二進制檔案,以<key,value>的形式序列化到檔案中
存盤方式:行存盤
優點:可分割、壓縮,一般選擇block壓縮,與hadoop api中的mapfile是互相兼容的,
- Rcfile
存盤方式:資料按行分塊 每塊按照列存盤
壓縮快 快速列存取
讀記錄盡量涉及到的block最少
讀取需要的列只需要讀取每個row group 的頭部定義,
讀取全量資料的操作 性能可能比sequencefile沒有明顯的優勢
- ORC
存盤方式:資料按行分塊 每塊按照列存盤
壓縮快 快速列存取
效率比rcfile高,是rcfile的改良版本
官網介紹:
The Optimized Row Columnar (ORC) file format provides a highly efficient way to store Hive data. It was designed to overcome limitations of the other Hive file formats. Using ORC files improves performance when Hive is reading, writing, and processing data.
ORC實際上是在RC檔案存盤格式做了一些優化,它的主要優點有:
(1)、每個task只輸出單個檔案,這樣可以減少NameNode的負載;
(2)、支持各種復雜的資料型別,比如: datetime, decimal, 以及一些復雜型別(struct, list, map, and union);
(3)、在檔案中存盤了一些輕量級的索引資料;
(4)、基于資料型別的塊模式壓縮:a、integer型別的列用行程長度編碼(run-length encoding);b、String型別的列用字典編碼(dictionary encoding);
(5)、用多個互相獨立的RecordReaders并行讀相同的檔案;
(6)、無需掃描markers就可以分割檔案;
(7)、系結讀寫所需要的記憶體;
(8)、metadata的存盤是用 Protocol Buffers的,所以它支持添加和洗掉一些列,
- 自定義格式
用戶可以通過實作inoutformat和outputformat來定義輸入輸出格式,
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/44439.html
標籤:大數據
上一篇:Zookeeper分布式集群搭建
