Java Code Examples for org.roaringbitmap.buffer.ImmutableRoaringBitmap#or()

The following examples show how to use org.roaringbitmap.buffer.ImmutableRoaringBitmap#or() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: InvertIndexSearcher.java    From kylin-on-parquet-v2 with Apache License 2.0 5 votes vote down vote up
private EvalResult doEvalCompareIn(CompareTupleFilter filter) {
    EvalResult result = new EvalResult();
    String column = filter.getColumn().getName();
    ColInvertIndexSearcher colSearcher = colIndexSearchers.get(column);
    if (colSearcher == null) {
        return EvalResult.ALL_MATCH;
    }
    List<ImmutableRoaringBitmap> bitmaps = Lists.newArrayList();
    for (Object value : filter.getValues()) {
        byte[] bytes = null;
        if (value instanceof ByteArray) {
            bytes = ((ByteArray)value).array();
        } else if (value instanceof byte[]) {
            bytes = (byte[])value;
        } else if (value instanceof String) {
            bytes = Bytes.toBytes((String)value);
        }
        ImmutableRoaringBitmap bitmap = colSearcher.searchValue(bytes);
        if (bitmap != null) {
            bitmaps.add(bitmap);
        }
    }
    if (bitmaps.isEmpty()) {
        return result;
    }

    result.bitmap = ImmutableRoaringBitmap.or(bitmaps.toArray(new ImmutableRoaringBitmap[bitmaps.size()]));
    return result;
}
 
Example 2
Source File: InvertIndexSearcher.java    From kylin with Apache License 2.0 5 votes vote down vote up
private EvalResult doEvalCompareIn(CompareTupleFilter filter) {
    EvalResult result = new EvalResult();
    String column = filter.getColumn().getName();
    ColInvertIndexSearcher colSearcher = colIndexSearchers.get(column);
    if (colSearcher == null) {
        return EvalResult.ALL_MATCH;
    }
    List<ImmutableRoaringBitmap> bitmaps = Lists.newArrayList();
    for (Object value : filter.getValues()) {
        byte[] bytes = null;
        if (value instanceof ByteArray) {
            bytes = ((ByteArray)value).array();
        } else if (value instanceof byte[]) {
            bytes = (byte[])value;
        } else if (value instanceof String) {
            bytes = Bytes.toBytes((String)value);
        }
        ImmutableRoaringBitmap bitmap = colSearcher.searchValue(bytes);
        if (bitmap != null) {
            bitmaps.add(bitmap);
        }
    }
    if (bitmaps.isEmpty()) {
        return result;
    }

    result.bitmap = ImmutableRoaringBitmap.or(bitmaps.toArray(new ImmutableRoaringBitmap[bitmaps.size()]));
    return result;
}
 
Example 3
Source File: WrappedImmutableRoaringBitmap.java    From bytebuffer-collections with Apache License 2.0 5 votes vote down vote up
@Override
public ImmutableBitmap union(ImmutableBitmap otherBitmap)
{
  WrappedImmutableRoaringBitmap other = (WrappedImmutableRoaringBitmap) otherBitmap;
  ImmutableRoaringBitmap unwrappedOtherBitmap = other.bitmap;
  return new WrappedImmutableRoaringBitmap(ImmutableRoaringBitmap.or(bitmap, unwrappedOtherBitmap));
}
 
Example 4
Source File: SlowMappedORaggregate1.java    From RoaringBitmap with Apache License 2.0 4 votes vote down vote up
@Benchmark
public MutableRoaringBitmap RoaringWithRun(BenchmarkState benchmarkState) {
  MutableRoaringBitmap answer = ImmutableRoaringBitmap.or(benchmarkState.rc.iterator());
  return answer;
}
 
Example 5
Source File: SlowMappedORaggregate2.java    From RoaringBitmap with Apache License 2.0 4 votes vote down vote up
@Benchmark
public MutableRoaringBitmap RoaringWithRun(BenchmarkState benchmarkState) {
  MutableRoaringBitmap answer = ImmutableRoaringBitmap.or(benchmarkState.rc.iterator());
  return answer;
}
 
Example 6
Source File: ImmutableRoaringBitmapWrapper.java    From RoaringBitmap with Apache License 2.0 4 votes vote down vote up
@Override
public Bitmap or(Bitmap other) {
  return new ImmutableRoaringBitmapWrapper(
      ImmutableRoaringBitmap.or(bitmap, ((ImmutableRoaringBitmapWrapper) other).bitmap));
}
 
Example 7
Source File: RoaringBitmapFactory.java    From bytebuffer-collections with Apache License 2.0 4 votes vote down vote up
@Override
public ImmutableBitmap union(Iterable<ImmutableBitmap> b)
{
  return new WrappedImmutableRoaringBitmap(ImmutableRoaringBitmap.or(unwrap(b).iterator()));
}