Search in sources :

Example 1 with WrappedImmutableRoaringBitmap

use of io.druid.collections.bitmap.WrappedImmutableRoaringBitmap in project druid by druid-io.

the class BitmapOffset method getReverseBitmapOffsetIterator.

public static IntIterator getReverseBitmapOffsetIterator(ImmutableBitmap bitmapIndex) {
    ImmutableBitmap roaringBitmap = bitmapIndex;
    if (!(bitmapIndex instanceof WrappedImmutableRoaringBitmap)) {
        final MutableBitmap bitmap = ROARING_BITMAP_FACTORY.makeEmptyMutableBitmap();
        final IntIterator iterator = bitmapIndex.iterator();
        while (iterator.hasNext()) {
            bitmap.add(iterator.next());
        }
        roaringBitmap = ROARING_BITMAP_FACTORY.makeImmutableBitmap(bitmap);
    }
    return ((WrappedImmutableRoaringBitmap) roaringBitmap).getBitmap().getReverseIntIterator();
}
Also used : EmptyIntIterator(io.druid.extendedset.intset.EmptyIntIterator) IntIterator(org.roaringbitmap.IntIterator) ImmutableBitmap(io.druid.collections.bitmap.ImmutableBitmap) MutableBitmap(io.druid.collections.bitmap.MutableBitmap) WrappedImmutableRoaringBitmap(io.druid.collections.bitmap.WrappedImmutableRoaringBitmap)

Aggregations

ImmutableBitmap (io.druid.collections.bitmap.ImmutableBitmap)1 MutableBitmap (io.druid.collections.bitmap.MutableBitmap)1 WrappedImmutableRoaringBitmap (io.druid.collections.bitmap.WrappedImmutableRoaringBitmap)1 EmptyIntIterator (io.druid.extendedset.intset.EmptyIntIterator)1 IntIterator (org.roaringbitmap.IntIterator)1