Repository navigation
feat(read): prune Parquet row groups for multi-file data evolution - #607
linchen1101 wants to merge 1 commit into
Conversation
|
@lxy-9602 有空的时候帮忙review一下?针对data evolution 跨文件的谓词下推支持。 |
Use the newest file for each predicate field and intersect candidate row ID ranges before merging. Cover cross-file predicates and residual filtering in the Data Evolution regression.
404e1ff to
5bc536d
Compare
|
Thank you for your contribution! Before the code review, please prepare an issue for the new feature and link it to the PR. Also, could you please use English in comments? Thanks! |
| ConcatBatchReader(std::vector<std::unique_ptr<BatchReader>>&& readers, | ||
| const std::shared_ptr<arrow::MemoryPool>& arrow_pool); | ||
| const std::shared_ptr<arrow::MemoryPool>& arrow_pool, | ||
| std::shared_ptr<Metrics> finished_reader_metrics = nullptr); |
There was a problem hiding this comment.
Please avoid using default parameters in production code under src. If the change is relatively large, consider adding an overloaded constructor instead.
|
|
||
| void PrefetchFileBatchReaderImpl::CollectPrefetchMetrics( | ||
| const std::shared_ptr<Metrics>& result) const { | ||
| auto set_prefetch_counter = [&result](const char* name, const std::atomic<uint64_t>& value) { |
There was a problem hiding this comment.
Since result is a standard out parameter that doesn’t require ownership, I suggest using a raw pointer to make it explicit.
| const std::shared_ptr<DataFilePathFactory>& data_file_path_factory, | ||
| const RoaringBitmap32* exact_selection) const; | ||
| const RoaringBitmap32* exact_selection, | ||
| std::unique_ptr<FileBatchReader> opened_reader = nullptr) const; |
There was a problem hiding this comment.
Please avoid default parameters, or alternatively add a new overload and remove unrelated parameters like reader_builder, etc.
| /// files sharing one row-id range shares the intersection of its file-index selections across | ||
| /// all child readers to preserve alignment. | ||
| /// files with the same row-id range shares a selection from file indexes and Parquet row-group | ||
| /// statistics across all child readers to preserve alignment. |
There was a problem hiding this comment.
In core/common code, we don’t explicitly state that it must be Parquet (or give Parquet as an example), because it’s a format plugin.
|
|
||
| std::optional<RoaringBitmap32> SelectByRowGroupStats( | ||
| const std::shared_ptr<DataFileMeta>& file, const std::shared_ptr<Predicate>& predicate, | ||
| const DataFilePathFactory& data_file_path_factory, OpenedFileReaders& opened_readers) const; |
There was a problem hiding this comment.
Please avoid OpenedFileReaders&. If it’s an output parameter, use a pointer directly; otherwise use const& to make it explicit. Also, please avoid default parameters. Thanks!
| std::all_of(files.begin(), files.end(), [](const auto& file) { | ||
| return DataEvolutionUtils::IsNormalFile(file->file_name) && | ||
| StringUtils::EndsWith(file->file_name, ".parquet") && | ||
| file->row_count <= std::numeric_limits<int32_t>::max(); |
There was a problem hiding this comment.
StringUtils::EndsWith(file->file_name, ".parquet") feels too tailored. Could we adjust it to avoid hardcoding Parquet specifically? At least, we should use DataFileMeta->FileFormat() instead of checking the .parquet suffix.
| file->row_count <= std::numeric_limits<int32_t>::max(); | ||
| }); | ||
| if (!use_file_indexes && !can_use_row_group_stats) { | ||
| return std::optional<RoaringBitmap32>(); |
There was a problem hiding this comment.
In Java, we enable the corresponding feature via the data-evolution.merged-read.stats-pushdown.enabled configuration. Please add this config to both defs and core_options.
| /// files with the same row-id range shares a selection from file indexes and Parquet row-group | ||
| /// statistics across all child readers to preserve alignment. | ||
| /// | ||
| /// Deletion vectors are supported: a row range group's vector is maintained against the |
There was a problem hiding this comment.
I’d also like to ask: is there any plan to support page index filtering in the future? If so, please add a TODO describing that it’s currently a subset of the Java functionality (apache/paimon#10394) , and that we plan to add the remaining parts later.
Purpose
Linked issue: Closes #616
Data Evolution can store columns from the same rows in separate Parquet files. Use the newest file for each predicate field and intersect candidate row ID ranges before merging. Keep residual filtering after the merge for exact results, and account for footer I/O when an entire file group is pruned.
Tests
DataEvolutionTableTest.TestMergedParquetRowGroupPredicatePushDowncovers cross-file predicates, residual filtering, and files with different row-group boundaries on an unbucketed table. It also covers skipped-group metrics for direct reads and parallel prefetch with and without read-ahead caching.DataEvolutionTableTest.TestMergedParquetPushDownWithOverwrittenNestedFieldcovers filtering on a base-file column while reading an evolved nested field from its replacement file.DataEvolutionTableTest.TestPartitionWithPredicateto cover the intersection of Parquet row-group pruning and explicit row ID ranges.API and Format
Adds the optional
RowGroupFilterinterface ininclude/paimon/reader/file_batch_reader.hfor obtaining candidate row ranges and reporting metadata I/O for skipped readers. The optimization uses existing Parquet footer metadata and Paimon row IDs. Storage format and protocol impact is zero.Documentation
The optimization applies automatically to eligible multi-file Data Evolution Parquet reads using existing reader settings.
Generative AI tooling
Generated-by: OpenAI Codex (gpt-6.2-sol)