Repository navigation
roaring_bridge: Go back to collect() in RoaringBitmap32::ToVec - #280
Open
dhivadhiva wants to merge 1 commit into
Open
dhivadhiva wants to merge 1 commit into
dhivadhiva wants to merge 1 commit into
Conversation
473adb3 switched ToVec to Iter::next_many again, after 69847f6 had undone the same change because of RoaringBitmap/roaring-rs#403. That issue is still open and roaring 0.12.0 is the latest release, so the bug is back: next_many computes the length of a run as a u16, which overflows for a run container that covers all 65536 values of its key. RoaringBitmap32 bm; bm.InsertRange(0, 70000); bm.ToVec(); In a release build this returns 70000 values that start at 65536 and end in zeros. In a debug build, which is what this repo's CMake builds by default, the overflow panics, and the panic aborts the process. The 15-byte serialized form of 0..65535 does the same through Deserialize(). Collect through the iterator again, as RoaringBitmap64::ToVec does, and add tests for both cases.
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.
473adb3 ("Improve performance for
ToVec") brought back theIter::next_manyversion ofRoaringBitmap32::ToVec, which 69847f6 had undone because of RoaringBitmap/roaring-rs#403. That issue is still open, its fix (RoaringBitmap/roaring-rs#404) is not merged, and roaring 0.12.0 is still the latest release, soToVecis broken onmainagain.The bug
next_manycomputes the length of a run as au16(interval_store.rs:894), which overflows for a run container that covers all 65536 values of its key:65536, 65537, …and end in 65536 zeros. Only 4464 of them get filled.attempt to add with overflow, and the panic aborts the process because it can't unwind through the Crubit thunk.0..65535(3B 30 00 00 01 00 00 FF FF 01 00 00 00 FF FF) passesDeserialize(), andToVec()on the result fills none of the 65536 values.RoaringBitmap64::ToVecand thebegin()/end()iterators still usenext()and are not affected.Fix
ToVeccollects through the iterator again, asRoaringBitmap64::ToVecdoes. A comment points at the upstream issue, sonext_manycan come back once a fixed roaring release can be required.Testing
Two new tests in
roaring_bridge_cc_test:RoaringBitmapTest/*.ToVecWithFullRunContainer:InsertRange(0, 70000), then compareToVec()with0..69999, for both bitmap types.RoaringBitmap32Test.ToVecAfterDeserializingFullRunContainer: deserialize the 15 bytes above, then compareToVec()with0..65535.On
main, both 32-bit cases abort with the overflow panic, which stops the whole test binary. With this change, all 45 tests pass. Built with the CI recipe (cmake -B build -S roaring_bridge, Crubit b715411, nightly-2026-11-11), andctestruns these tests in CI.