Repository navigation
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.
Why
The Parquet opener currently loads every Bloom filter for every literal column across all surviving row groups up front, one
get_row_group_column_bloom_filtercall at a time, and only then evaluates the predicate. That has three costs. Columns that only appear in!=/NOT INare fetched even though a Bloom filter can never prune them. Fora = 1 AND b = 2,b's filters are fetched for row groups thataalready pruned. Each filter is a separate small read (header, then body), done in series. The opener also builds a second file reader withcreate_reader()on every file just for this step.What changed
Guarantee::Inliterals are Bloom candidates.=,IN) but never that a row group holds only excluded values. Columns that appear only in!=/NOT INare no longer fetched.ORstays sound.bloom_filter_lengthis present, the opener requests the exact[offset, offset + length)ranges withget_byte_rangesand decodes them withSbbf::from_bytes. It no longer builds a second reader for each file.ParquetFileReader::get_byte_rangesnow uses its own bounds-checked coalescer (1 MiB gap, 8 MiB max coalesced span, 10 concurrent fetches). Zero-length ranges return empty bytes without storage reads, inverted or overflowing totals returnParquetError::Generalbefore updating metrics, and short reads returnParquetError::EOFinstead of panicking.get_row_group_column_bloom_filterpath is used. Its reader is created lazily, at most once per file.predicate_evaluation_errors.RowGroupAccessPlanFilter::prune_subset_by_bloom_filtersrecords onlypruned.matchedis added once after the last pass, sopruned + matchedequals the number of row groups that entered. The existingprune_by_bloom_filterskeeps its behavior.+716 / −139lines (opener Bloom state and candidate selection, bounds-checked reader coalescing, row-group filter subset helper).+1,508 / −12lines, including an I/O-recording store that asserts exact Bloom byte ranges, backing-store fetch bounds, and single-reader counts.Scope & caveats
bloom_filter_on_readstill controls the whole step.ParquetFileReaderrange reads, not just Bloom filters. Merging behavior matches the previous defaults, and a short read now returns an error instead of panicking. CustomParquetFileReaderFactoryreaders keep their ownget_byte_ranges.bloom_filter_lengthuse the legacy per-filter path, which is still column-by-column but not batched.Verification
NOT IN/!=fetching no Bloom filters;ANDstopping before the second column when the first prunes everything; the second column fetched only for surviving row groups;matchedcounted once when both columns survive; ordering by literal count with size tie-break; cross-columnOR/ DNF soundness; multiple row groups in a singleget_byte_rangescall with no extra reader; bounded multi-batch splitting with the same result as unbatched; missing-length fallback; malformed metadata, corrupted payloads, and a truncated object all failing open without panics; coalescer ordering, duplicates, gaps, short reads, and inverted ranges.cargo fmt --all -- --check: passed.cargo clippy -p datafusion-datasource-parquet --all-targets --all-features -- -D warnings: passed.cargo test -p datafusion-datasource-parquet --all-features(withPARQUET_TEST_DATA): 243/243 unit tests passed, 4/4 doctests passed (5 pre-existing ignored doctests).