apache / apache/datafusion

Preserve bitmap-backed `RowSelection` in `ParquetAccessPlan`

Open
#23,883 4 comments 0 reactions 1 assignee Claimed by @haohuaijin View on GitHub
enhancement
Dominant language
Rust
Stars
9.3k
Forks
2.4k
Avg merge
3d 7h
Merged PRs (30d)
344

Description

### Is your feature request related to a problem or challenge?

[arrow-rs#10141](https://github.com/apache/arrow-rs/pull/10141) allows `RowSelection` to be backed by a `BooleanBuffer`.

However, `ParquetAccessPlan::into_overall_row_selection` currently calls `RowSelection::iter()` and converts each selection into a `Vec`. This materializes mask-backed selections as RLE and loses the bitmap backing before it reaches the Parquet reader.

This issue is blocked until DataFusion upgrades to an Arrow/Parquet release containing `arrow-rs#10141`.

### Describe the solution you'd like

- Validate selection length using `row_count() + skipped_row_count()` instead of `iter()`.
- When all row-group selections are mask-backed, concatenate their `BooleanBuffer`s directly.
- Represent scanned row groups as all-set bitmap ranges and omit skipped row groups.
- Keep the existing selector path as the fallback for selector-backed or mixed inputs.

### Describe alternatives you've considered

Converting selectors back to a bitmap in the Parquet reader does not help because the large intermediate `Vec` has already been allocated.

### Additional context

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.