【问题标题】:Using PageIndex, why parquet does not skip unnecessary pages?使用 PageIndex,为什么 parquet 不会跳过不必要的页面?
【发布时间】:2019-06-17 15:38:41
【问题描述】:

使用parquet-mr@1.11.0,我有一个架构,例如:

schema message page {
  required binary url (STRING);
  optional binary content (STRING);
}
  • 我正在通过url 进行单行查找以检索关联的content
  • 行按url排序。

文件是用以下方式创建的:

  • parquet.block.size:256 MB
  • parquet.page.size:10 MB

使用parquet-tools 我能够验证我确实有我的列索引和/或我的列的偏移量:

column index for column url:
Boudary order: ASCENDING
                      null count  min                                       max
page-0                         0  http://materiais.(...)delos-de-curriculo  https://api.quero(...)954874/toogle_like
page-1                         0  https://api.quero(...)880/toogle_dislike  https://api.quero(...)ior-online/encceja
page-2                         0  https://api.quero(...)erior-online/todos  https://api.quero(...)nte-em-saude/todos

offset index for column url:
                          offset   compressed size       first row index
page-0                         4            224274                     0
page-1                    224278            100168                 20000
page-2                    324446             67778                 40000


column index for column content:
NONE
offset index for column content:
                          offset   compressed size       first row index
page-0                    392224            504412                     0
page-1                    896636            784246                   125
page-2                   1680882            641212                   200
page-3                   2322094            684826                   275
[... truncated ...]
page-596               256651848            183162                 53100

使用配置如下的阅读器:

   AvroParquetReader
      .<GenericRecord>builder(HadoopInputFile.fromPath(path, conf))
      .withFilter(FilterCompat.get(
        FilterApi.eq(
          FilterApi.binaryColumn(urlKey),
          Binary.fromString(url)
        )
      ))
      .withConf(conf)
      .build();

感谢column-indexcolumn-offsets,我希望读者只能阅读 2 页:

  • 使用列索引匹配min/maxurl
  • 然后,使用偏移索引包含content 的匹配行索引。

但我看到的是读者正在阅读和解码 content 列的数百页 (~250MB),我是否遗漏了 PageIndex 在 parquet-mr 中应该如何工作的一些内容?

查看“加载页面”和“跳过记录”日志行,这是试图在对 url 应用过滤器之前构建整个记录,我认为这违背了 PageIndex 的目的。

我试图上网查看阅读器的工作原理,但找不到任何东西。

编辑

我在parquet-column 上发现了一个 2015 年的公开 PR,暗示当前的读者(至少在当时)确实在应用谓词之前构建了包含所有必需列的整个记录​​:

https://github.com/apache/parquet-mr/pull/288

但在这种情况下,我看不到column offsets 的目的。

【问题讨论】:

    标签: parquet parquet-mr


    【解决方案1】:

    发现,尽管这不是我所期望的 the specs,但它正在按预期工作。

    来自this issue我引用:

    列 url 有 3 页。您的过滤器会发现 page-0 匹配项。根据偏移索引,它被转换为行范围 [0..19999]。因此,我们需要为列 url 加载 page-0,并且所有页面都在列内容的行范围 [0..19999] 内。

    【讨论】:

      猜你喜欢
      • 2017-03-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多