You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "haohuaijin (via GitHub)" <gi...@apache.org> on 2026/07/24 05:37:30 UTC
[I] Reuse `MaskSelection`'s cached selectors when converting a mask-backed `RowSelection` to selectors [arrow-rs]
haohuaijin opened a new issue, #10422:
URL: https://github.com/apache/arrow-rs/issues/10422
**Is your feature request related to a problem or challenge? Please describe what you are trying to do.**
Follow up to #10141, which made `RowSelection` optionally backed by a `BooleanBuffer` bitmap.
For mask-backed selections, `RowSelection::iter()` lazily materializes an RLE
selector cache inside `MaskSelection` (a `OnceLock<Vec<RowSelector>>`). However,
`RowSelection::into_selectors_vec()` (used by `From<RowSelection> for Vec<RowSelector>`
and `From<RowSelection> for VecDeque<RowSelector>`) ignores that cache and calls
`mask_to_selectors()` a second time. `selectors_mut()` has the same issue when
promoting a mask-backed selection to selector backing in place.
This means a caller that first iterates a selection and then consumes it converts
the entire bitmap to RLE twice. DataFusion's
`ParquetAccessPlan::into_overall_row_selection` does exactly this sequence: it
calls `iter()` for validation and then converts the selection into selectors.
Originally reported by @hhhizzz in
https://github.com/apache/arrow-rs/pull/10141#discussion_r3608544008
**Describe the solution you'd like**
When the lazy cache has already been populated, consume it instead of re-running
the conversion, e.g. take the `OnceLock`'s value in `into_selectors_vec()` /
`selectors_mut()` (`OnceLock::into_inner` / `OnceLock::take`) and fall back to
`mask_to_selectors()` only when the cache is empty.
**Describe alternatives you've considered**
Leave as is — the conversion is O(bitmap) either way, but doing it twice is pure
waste for large selections.
**Additional context**
Per review feedback on #10141, this should land with benchmark coverage, e.g.
extending `parquet/benches/row_selection_cursor.rs` with an
"iterate-then-consume" scenario over a mask-backed selection
(`cargo bench -p parquet --bench row_selection_cursor`).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Reuse `MaskSelection`'s cached selectors when converting a mask-backed `RowSelection` to selectors [arrow-rs]
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb closed issue #10422: Reuse `MaskSelection`'s cached selectors when converting a mask-backed `RowSelection` to selectors
URL: https://github.com/apache/arrow-rs/issues/10422
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org