Skip to content

feat(parquet): support page index filter for nested column type (patch arrow)#408

Draft
zhf999 wants to merge 9 commits into
alibaba:mainfrom
zhf999:nest-fix-arrow
Draft

feat(parquet): support page index filter for nested column type (patch arrow)#408
zhf999 wants to merge 9 commits into
alibaba:mainfrom
zhf999:nest-fix-arrow

Conversation

@zhf999

@zhf999 zhf999 commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

feat: support page index filter for nested column type

Purpose

Previously, page index filtering was only applied to flat (scalar) columns. When the read schema contained any nested field (struct, list, or map), the entire page index filter was disabled as a workaround, causing nested columns to fall back to rowgroup-level filtering only and miss fine-grained page-level I/O skipping.

This PR extends page index filtering to nested column types. The core idea is to leverage Arrow's ColumnReader tree (created via FileReader::GetColumn with a custom FileColumnIteratorFactory) so that:

  1. Per-leaf data_page_filter: The factory sets a data_page_filter callback on every leaf FileColumnIterator, enabling I/O-level page skipping for all leaves of a nested type.
  2. Per-leaf skip/read pattern: A new LoadBatchWithRowFilter method is added to Arrow's ColumnReader interface. It walks the reader tree, delegating to each leaf a skip/read pattern derived from RowRanges + OffsetIndex (via ComputeCompressedRowRanges). This replaces the previous approach of manually driving RecordReader::SkipRecords/ReadRecords per leaf column.
  3. Unified code path: ReadFilteredColumn (per-leaf, manual skip/read) is replaced by ReadFilteredField (per top-level field, ColumnReader tree), unifying flat and nested column filtering into a single path.

Key implementation changes:

  • Arrow patch (cmake_modules/arrow.diff): Adds GetColumn overload with FileColumnIteratorFactory, LoadBatchWithRowFilter virtual method, and LeafRowFilter type alias to the Parquet Arrow reader. Also makes io::InputStream::Advance virtual.
  • PageFilteredRowGroupReader: Now accepts arrow::FileReader* (instead of ParquetFileReader*) for ColumnReader tree creation. Uses SchemaManifest::GetFieldIndices to group leaf columns by top-level field. Builds result schema from actual column types to correctly handle sub-column projection.
  • FileReaderWrapper: Removes BuildPageFilteredSchema and page_filtered_read_schema_ (no longer needed; schema is built from actual types in ReadFilteredRowGroup).
  • ParquetFileBatchReader: Removes the has_nested_field check that previously disabled page index filter for nested fields.

Tests

UT — PageFilteredRowGroupReaderTest (src/paimon/format/parquet/page_filtered_row_group_reader_test.cpp):

  • NestedStructColumnRowGroupFilter — rowgroup-level filtering on struct columns (fixed expected row count)
  • NestedStructColumnOnlyReadIdField — reading only the flat id field from a file with nested struct
  • NestedListColumnRowGroupFilter — rowgroup-level filtering on list column
  • NestedMapColumnRowGroupFilter — rowgroup-level filtering on map column
  • MultipleAdjacentNestedColumns — multiple adjacent nested columns
  • MultipleNestedColumns (new) — predicate pushdown with all nested types (struct, list, map) and page-level filtering
  • NestedStructSubColumnProjection (new) — sub-column projection of a struct type with page-level filtering

API and Format

  • Arrow dependency patch (cmake_modules/arrow.diff): Adds new virtual methods (GetColumn with factory, LoadBatchWithRowFilter) and types (LeafRowFilter, FileColumnIteratorFactory) to Arrow's Parquet Arrow reader. These are additions to the third-party Arrow library via patch, not changes to Paimon's public API.
  • Internal API change: PageFilteredRowGroupReader::ReadFilteredRowGroup signature changed — now takes parquet::arrow::FileReader* instead of parquet::ParquetFileReader*, and no longer takes arrow::Schema. This is an internal API (not in include/).
  • No storage format or protocol changes.

Documentation

No new user-facing feature documentation needed — this is an internal performance optimization that is transparent to users.

Generative AI tooling

Generated-by: GLM 5.2

@zhf999 zhf999 changed the title Nest fix arrow feat(parquet): support page index filter for nested column type (patch arrow) Jul 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant