perf: reduce IO requests from loading bitmap index#6703
Merged
wjones127 merged 2 commits intoMay 6, 2026
Conversation
Previously, BitmapIndex::load read all keys into a single RecordBatch before iterating them into the index map. With large cardinality columns (e.g. 1M unique 1KB strings), this doubled peak memory since both the batch and the map must coexist. Add a streaming read_range_stream API to IndexReader that returns a stream of batches instead of a single collected batch. The current_reader::FileReader implementation uses the new read_range_as_stream method on FileReader to pass a per-call batch_size_bytes (8MB default), enabling byte-bounded batching for v2.1+ files with a graceful fallback for v2.0. BitmapIndex::load now consumes the keys column as a stream, keeping only one batch in memory at a time. This also reduces IOPs from ceil(N/2048) to a single streaming read with readahead. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Contributor
|
ACTION NEEDED The PR title and description are used as the merge commit message. Please update your PR title and description to match the specification. For details on the error please inspect the "PR Title Check" action. |
Remove the dedicated read_range_as_stream method from FileReader and instead call read_stream_projected directly in the IndexReader override. Return Pin<Box<dyn RecordBatchStream>> to avoid double boxing. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
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.
Current code loads 2048 values from lookup file at a time, regardless of width. This PR changes us to stream, and defers the choice of batch size to the reader.
In my simple benchmark, this reduced IO requests 55x (down to 9 from 497).
Closes #6660
🤖 Generated with Claude Code