1 / 10

Orcfile 简介

Orcfile 简介. 丁冬超. 主要内容. Orcfile 简介 && 优点 存储架构图 压缩 空值优化 利用 index 的读取过滤 ( 谓词下推 ). Orcfile 简介. 简介 HortonWorks 工程师 O‘Malley 是贡献到 hive 上的一种数据存储格式 Orcfile (Optimized Row Columnar) , hive0.11 开始支持 ,和 RCFile 类似,一些 row 为一个存储块,块内每列按照列存储。 baidu -hive ,是上研的 udw 团队将 orcfile 集成进去 优点 压缩比高,压缩比达 10 以上

Download Presentation

Orcfile 简介

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Orcfile简介 丁冬超

  2. 主要内容 • Orcfile简介&&优点 • 存储架构图 • 压缩 • 空值优化 • 利用index的读取过滤(谓词下推)

  3. Orcfile简介 • 简介 HortonWorks工程师O‘Malley是贡献到hive上的一种数据存储格式Orcfile(Optimized Row Columnar),hive0.11开始支持 ,和RCFile类似,一些row为一个存储块,块内每列按照列存储。 baidu-hive,是上研的udw团队将orcfile集成进去 • 优点 压缩比高,压缩比达10以上 过滤性读取数据,谓词下推 • 主页 http://docs.hortonworks.com/HDPDocuments/HDP2/HDP-2.0.0.2/ds_Hive/orcfile.html

  4. Orcfile存储结构图 Stripe:一个存储块的概念,一般是大小设置为256M,块内数据按照列存储 Stripe footer :stripe”头”的概念,存储块中各列存储信息 Index Data :每列的一个简单统计:最大值、最小值、sum ,每隔N行记录一下,并记录这个统计的数据offset File Footer :文件“头”,记录文件中有多少个stripe以及每个stripe的数据offset信息。

  5. 压缩 • 针对列的不同类型采取不同的压缩方式 • 几种压缩优化 整型数值型:run-length 字符串:字典编码 时间:转换成整数,采用run-length Boolean:采用bit存储

  6. Run-length • 标准run-length,主要用在点整图形的存储上,采用 重复值个数+重复值 。 • 改进的run-length,等差数组的概念 个数+等差值+开始值,官方简介: If the first byte (b0) is negative: • -b0 variable-length integers follow. If the first byte (b0) is positive: • it represents b0 + 3 repeated integers • the second byte (-128 to +127) is added between each repetition • 1 variable-length integer. • 待补充

  7. 空值NULL优化 • 写存储:对于每一个有空值null的列存储了两部分 bit数组:1110000000111…..,长度是row数目,如果相应 的index值为null,则在数组中相应index就为1 真正的no-null值 • 读取 读到相应index值先去读bit数组中是否为1 ,!=1的话读取一个no-null值返回 。

  8. Index做谓词下推操作 • 每N行做成一个段,段中的每列对应着相应的一个IndexData:最大值、最小值 • 通过上层传过来的谓词条件过滤掉一些段,减少读取的数据量

  9. Index做谓词下推操作 • 优点 谓词下推,过滤减少数据读取量 • 带来的问题 顺序读取,过滤掉一些段后带来读取碎片 • 测试结果 较小过滤单带来读取碎片的时候,提升效果不明显 较大过滤和过滤后碎片少时候均能明显提高读取效率

  10. Q & A • Q&A?

More Related