File tree Expand file tree Collapse file tree 2 files changed +12
-4
lines changed
Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -39,9 +39,13 @@ func ParOr(parallelism int, bitmaps ...*Bitmap) *Bitmap {
3939 // on some systems, would block indefinitely.
4040 keyRange := uint64 (hKey ) - uint64 (lKey ) + 1
4141 if keyRange == 1 {
42- // revert to FastOr. Since the key range is 0
43- // no container-level aggregation parallelism is achievable
44- return FastOr (bitmaps ... )
42+ // All bitmaps have the same key,
43+ // we can merge the 32-bit roaring bitmaps in parallel
44+ var bms32s = make ([]* roaring.Bitmap , 0 , len (bitmaps ))
45+ for _ , b := range bitmaps {
46+ bms32s = append (bms32s , b .highlowcontainer .containers ... )
47+ }
48+ return roaring32AsRoaring64 (roaring .ParOr (parallelism , bms32s ... ), lKey )
4549 }
4650
4751 if parallelism == 0 {
Original file line number Diff line number Diff line change @@ -1248,9 +1248,13 @@ func (rb *Bitmap) Validate() error {
12481248// Roaring32AsRoaring64 inserts a 32-bit roaring bitmap into
12491249// a 64-bit roaring bitmap. No copy is made.
12501250func Roaring32AsRoaring64 (bm32 * roaring.Bitmap ) * Bitmap {
1251+ return roaring32AsRoaring64 (bm32 , 0 )
1252+ }
1253+
1254+ func roaring32AsRoaring64 (bm32 * roaring.Bitmap , key uint32 ) * Bitmap {
12511255 rb := NewBitmap ()
12521256 rb .highlowcontainer .resize (0 )
1253- rb .highlowcontainer .keys = append (rb .highlowcontainer .keys , 0 )
1257+ rb .highlowcontainer .keys = append (rb .highlowcontainer .keys , key )
12541258 rb .highlowcontainer .containers = append (rb .highlowcontainer .containers , bm32 )
12551259 rb .highlowcontainer .needCopyOnWrite = append (rb .highlowcontainer .needCopyOnWrite , false )
12561260 return rb
You can’t perform that action at this time.
0 commit comments