refractor(parquet): simplify FileReaderWrapper and PageFilteredRowGroupReader with unified TargetRowGroup structure#334
Open
zhf999 wants to merge 16 commits into
Open
refractor(parquet): simplify FileReaderWrapper and PageFilteredRowGroupReader with unified TargetRowGroup structure#334zhf999 wants to merge 16 commits into
zhf999 wants to merge 16 commits into
Conversation
…mber variables in FileBatchReader
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Refactors Parquet reading to unify row-group targeting (including page-level filtered ranges), centralize Parquet/Arrow exception handling, and tighten predicate filtering behavior.
Changes:
- Introduces
TargetRowGroupand propagates it through readers/tests to carry row-group index + page-filter row ranges. - Moves
PAIMON_PARQUET_CATCH_AND_RETURN_STATUSinto a shared header and updates callers. - Adds conservative fallback in
ColumnIndexFilterwhen comparison predicates have empty literals, with new tests.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| src/paimon/format/parquet/row_ranges.h | Adds RowRanges move-ctor and introduces TargetRowGroup for carrying per-RG filtering info |
| src/paimon/format/parquet/parquet_format_defs.h | Adds shared macro to convert exceptions to Status |
| src/paimon/format/parquet/parquet_file_batch_reader.h | Switches read-range application to ApplyReadRanges |
| src/paimon/format/parquet/parquet_file_batch_reader.cpp | Refactors schema setup and read-range application around TargetRowGroup |
| src/paimon/format/parquet/page_filtered_row_group_reader.h | Updates APIs to accept TargetRowGroup and factors helpers into private methods |
| src/paimon/format/parquet/page_filtered_row_group_reader.cpp | Implements new helpers and updates page-filtered read logic to use TargetRowGroup |
| src/paimon/format/parquet/file_reader_wrapper.h | Replaces row-group index sets with TargetRowGroup list and adds ApplyReadRanges API |
| src/paimon/format/parquet/file_reader_wrapper.cpp | Refactors reading loop into page-filtered vs fully-matched paths, adds prebuffer range collection, implements ApplyReadRanges |
| src/paimon/format/parquet/page_filtered_row_group_reader_test.cpp | Updates tests to pass TargetRowGroup |
| src/paimon/format/parquet/file_reader_wrapper_test.cpp | Updates tests for new PrepareForReading* signatures and new ApplyReadRanges behavior |
| src/paimon/format/parquet/column_index_filter.cpp | Adds conservative fallback when literals are empty for non-null-check predicates |
| src/paimon/format/parquet/column_index_filter_test.cpp | Adds tests covering empty-literals behavior for comparison and IN predicates |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Purpose
Linked issue: N/A
Pevious PR #330, please review #330 first.
Refactor
FileReaderWrapperandPageFilteredRowGroupReaderto improve readability, reduce code duplication, and simplify the calling interface:TargetRowGroupstruct — Replace scatteredtarget_row_group_indices_,row_group_row_ranges_,page_filtered_indices_with a singlestd::vector<TargetRowGroup>that carries row group index, page-filter flag, and row ranges together.The
TargetRowGroupstuct is define as follows:Simplify
SetReadRangescalling chain — IntroduceFileReaderWrapper::ApplyReadRanges()that directly mutatestarget_row_groups_in-place, eliminating the round-trip throughFilterRowGroupsByReadRanges→ rebuild →PrepareForReadingLazy. Removeread_row_groups_andread_column_indices_fromParquetFileBatchReader.Split long methods into focused helpers — Break
PrepareForReading()(~120 lines),Next()(~100 lines), andSeekToRow()into smaller single-responsibility methods:AdvanceToNextRowGroup(),NextPageFiltered(),NextFullyMatched()BuildPageFilteredSchema(),CollectPreBufferRanges(),DispatchPreBuffer()Refactor
PageFilteredRowGroupReader— ExtractGetPageRowRange()(eliminating 3x duplicated page row-range calculation),WaitForPreBuffer(),ExecuteSkipReadPattern(). UseTargetRowGroupinReadFilteredRowGroupandComputePageRangessignatures to reduce parameter count.Tests
paimon-parquet-format-testpass without modification to test logic (only call-site syntax adapted).FileReaderWrapperTest,PageFilteredRowGroupReaderTest,ParquetFileBatchReaderTest.API and Format
FileReaderWrapper::PrepareForReading/PrepareForReadingLazynow acceptstd::vector<TargetRowGroup>instead ofstd::set<int32_t>.FileReaderWrapper::FilterRowGroupsByReadRangesremoved, replaced byApplyReadRanges.PageFilteredRowGroupReader::ReadFilteredRowGroup/ComputePageRangesnow acceptconst TargetRowGroup&instead of separaterow_group_index+row_ranges.Documentation
No new features introduced. Internal refactoring only.
Generative AI tooling
Generated-by: Aone Copilot (Claude 4.7 Opus)