use of org.apache.druid.extendedset.intset.ImmutableConciseSet in project druid by druid-io.
the class BitmapOperationTestBase method testConciseUnion.
@Test
public void testConciseUnion() {
ImmutableConciseSet union = ImmutableConciseSet.union(CONCISE);
Assert.assertEquals(unionCount, union.size());
}
use of org.apache.druid.extendedset.intset.ImmutableConciseSet in project druid by druid-io.
the class BitmapOperationTestBase method makeOffheapConcise.
protected static ImmutableConciseSet makeOffheapConcise(ImmutableConciseSet concise) {
final byte[] bytes = concise.toBytes();
totalConciseBytes += bytes.length;
conciseCount++;
final ByteBuffer buf = ByteBuffer.allocateDirect(bytes.length).put(bytes);
buf.rewind();
return new ImmutableConciseSet(buf.asIntBuffer());
}
use of org.apache.druid.extendedset.intset.ImmutableConciseSet in project druid by druid-io.
the class WrappedImmutableConciseBitmap method intersection.
@Override
public ImmutableBitmap intersection(ImmutableBitmap otherBitmap) {
WrappedImmutableConciseBitmap other = (WrappedImmutableConciseBitmap) otherBitmap;
ImmutableConciseSet unwrappedOtherBitmap = other.bitmap;
return new WrappedImmutableConciseBitmap(ImmutableConciseSet.intersection(bitmap, unwrappedOtherBitmap));
}
use of org.apache.druid.extendedset.intset.ImmutableConciseSet in project druid by druid-io.
the class ConciseComplementBenchmark method uncompressed.
@Benchmark
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.MICROSECONDS)
public void uncompressed(Blackhole blackhole) {
final ImmutableConciseSet set = ImmutableConciseSet.complement(null, emptyRows);
blackhole.consume(set);
assert (emptyRows == set.size());
}
use of org.apache.druid.extendedset.intset.ImmutableConciseSet in project druid by druid-io.
the class BitmapBenchmarkUtils method toOffheap.
public static ImmutableBitmap toOffheap(ImmutableBitmap bitmap) throws IOException {
if (bitmap instanceof WrappedImmutableConciseBitmap) {
final WrappedImmutableConciseBitmap conciseBitmap = (WrappedImmutableConciseBitmap) bitmap;
final byte[] bytes = conciseBitmap.getBitmap().toBytes();
final ByteBuffer buf = ByteBuffer.allocateDirect(bytes.length).put(bytes);
buf.rewind();
return new WrappedImmutableConciseBitmap(new ImmutableConciseSet(buf.asIntBuffer()));
} else if (bitmap instanceof WrappedImmutableRoaringBitmap) {
final WrappedImmutableRoaringBitmap roaringBitmap = (WrappedImmutableRoaringBitmap) bitmap;
final ByteArrayOutputStream out = new ByteArrayOutputStream();
roaringBitmap.getBitmap().serialize(new DataOutputStream(out));
final byte[] bytes = out.toByteArray();
final ByteBuffer buf = ByteBuffer.allocateDirect(bytes.length);
buf.put(bytes);
buf.rewind();
return new WrappedImmutableRoaringBitmap(new ImmutableRoaringBitmap(buf.asReadOnlyBuffer()));
} else {
throw new IAE("Unsupported bitmap type [%s]", bitmap.getClass().getSimpleName());
}
}
Aggregations