Search in sources :

Example 6 with ConciseSet

use of io.druid.extendedset.intset.ConciseSet in project druid by druid-io.

the class WrappedConciseBitmap method or.

@Override
public void or(MutableBitmap mutableBitmap) {
    WrappedConciseBitmap other = (WrappedConciseBitmap) mutableBitmap;
    ConciseSet unwrappedOtherBitmap = other.bitmap;
    bitmap.addAll(unwrappedOtherBitmap);
}
Also used : ConciseSet(io.druid.extendedset.intset.ConciseSet) ImmutableConciseSet(io.druid.extendedset.intset.ImmutableConciseSet)

Example 7 with ConciseSet

use of io.druid.extendedset.intset.ConciseSet in project druid by druid-io.

the class WrappedConciseBitmap method xor.

@Override
public void xor(MutableBitmap mutableBitmap) {
    WrappedConciseBitmap other = (WrappedConciseBitmap) mutableBitmap;
    ConciseSet unwrappedOtherBitmap = other.bitmap;
    bitmap = bitmap.symmetricDifference(unwrappedOtherBitmap);
}
Also used : ConciseSet(io.druid.extendedset.intset.ConciseSet) ImmutableConciseSet(io.druid.extendedset.intset.ImmutableConciseSet)

Example 8 with ConciseSet

use of io.druid.extendedset.intset.ConciseSet in project druid by druid-io.

the class WrappedConciseBitmap method difference.

@Override
public ImmutableBitmap difference(ImmutableBitmap otherBitmap) {
    WrappedConciseBitmap other = (WrappedConciseBitmap) otherBitmap;
    ConciseSet unwrappedOtherBitmap = other.bitmap;
    return new WrappedConciseBitmap(bitmap.clone().difference(unwrappedOtherBitmap));
}
Also used : ConciseSet(io.druid.extendedset.intset.ConciseSet) ImmutableConciseSet(io.druid.extendedset.intset.ImmutableConciseSet)

Example 9 with ConciseSet

use of io.druid.extendedset.intset.ConciseSet in project druid by druid-io.

the class WrappedConciseBitmap method and.

@Override
public void and(MutableBitmap mutableBitmap) {
    WrappedConciseBitmap other = (WrappedConciseBitmap) mutableBitmap;
    ConciseSet unwrappedOtherBitmap = other.bitmap;
    bitmap = bitmap.intersection(unwrappedOtherBitmap);
}
Also used : ConciseSet(io.druid.extendedset.intset.ConciseSet) ImmutableConciseSet(io.druid.extendedset.intset.ImmutableConciseSet)

Example 10 with ConciseSet

use of io.druid.extendedset.intset.ConciseSet in project druid by druid-io.

the class ConciseBitmapFactoryTest method testGetOutOfBounds.

@Test
public void testGetOutOfBounds() {
    final ConciseSet conciseSet = new ConciseSet();
    final Set<Integer> ints = ImmutableSet.of(0, 4, 9);
    for (int i : ints) {
        conciseSet.add(i);
    }
    final ImmutableBitmap immutableBitmap = new WrappedImmutableConciseBitmap(ImmutableConciseSet.newImmutableFromMutable(conciseSet));
    final MutableBitmap mutableBitmap = new WrappedConciseBitmap(conciseSet);
    for (int i = 0; i < 10; ++i) {
        Assert.assertEquals(Integer.toString(i), ints.contains(i), mutableBitmap.get(i));
        Assert.assertEquals(Integer.toString(i), ints.contains(i), immutableBitmap.get(i));
    }
}
Also used : ConciseSet(io.druid.extendedset.intset.ConciseSet) ImmutableConciseSet(io.druid.extendedset.intset.ImmutableConciseSet) Test(org.junit.Test)

Aggregations

ConciseSet (io.druid.extendedset.intset.ConciseSet)10 ImmutableConciseSet (io.druid.extendedset.intset.ImmutableConciseSet)10 BitSet (java.util.BitSet)2 BeforeClass (org.junit.BeforeClass)2 MutableRoaringBitmap (org.roaringbitmap.buffer.MutableRoaringBitmap)2 Test (org.junit.Test)1