feat(parquet): support page index filter for nested column type (patch arrow)#408
Draft
zhf999 wants to merge 9 commits into
Draft
feat(parquet): support page index filter for nested column type (patch arrow)#408zhf999 wants to merge 9 commits into
zhf999 wants to merge 9 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
ColumnReadertree (created viaFileReader::GetColumnwith a customFileColumnIteratorFactory) so that:data_page_filter: The factory sets adata_page_filtercallback on every leafFileColumnIterator, enabling I/O-level page skipping for all leaves of a nested type.LoadBatchWithRowFiltermethod is added to Arrow'sColumnReaderinterface. It walks the reader tree, delegating to each leaf a skip/read pattern derived fromRowRanges+OffsetIndex(viaComputeCompressedRowRanges). This replaces the previous approach of manually drivingRecordReader::SkipRecords/ReadRecordsper leaf column.ReadFilteredColumn(per-leaf, manual skip/read) is replaced byReadFilteredField(per top-level field, ColumnReader tree), unifying flat and nested column filtering into a single path.Key implementation changes:
cmake_modules/arrow.diff): AddsGetColumnoverload withFileColumnIteratorFactory,LoadBatchWithRowFiltervirtual method, andLeafRowFiltertype alias to the Parquet Arrow reader. Also makesio::InputStream::Advancevirtual.PageFilteredRowGroupReader: Now acceptsarrow::FileReader*(instead ofParquetFileReader*) for ColumnReader tree creation. UsesSchemaManifest::GetFieldIndicesto group leaf columns by top-level field. Builds result schema from actual column types to correctly handle sub-column projection.FileReaderWrapper: RemovesBuildPageFilteredSchemaandpage_filtered_read_schema_(no longer needed; schema is built from actual types inReadFilteredRowGroup).ParquetFileBatchReader: Removes thehas_nested_fieldcheck 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 flatidfield from a file with nested structNestedListColumnRowGroupFilter— rowgroup-level filtering on list columnNestedMapColumnRowGroupFilter— rowgroup-level filtering on map columnMultipleAdjacentNestedColumns— multiple adjacent nested columnsMultipleNestedColumns(new) — predicate pushdown with all nested types (struct, list, map) and page-level filteringNestedStructSubColumnProjection(new) — sub-column projection of a struct type with page-level filteringAPI and Format
cmake_modules/arrow.diff): Adds new virtual methods (GetColumnwith 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.PageFilteredRowGroupReader::ReadFilteredRowGroupsignature changed — now takesparquet::arrow::FileReader*instead ofparquet::ParquetFileReader*, and no longer takesarrow::Schema. This is an internal API (not ininclude/).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