Search in sources :

Example 1 with BitmapObjectOutput

use of org.apache.hadoop.hive.ql.index.bitmap.BitmapObjectOutput in project hive by apache.

the class AbstractGenericUDFEWAHBitmapBop method evaluate.

@Override
public Object evaluate(DeferredObject[] arguments) throws HiveException {
    assert (arguments.length == 2);
    Object b1 = arguments[0].get();
    Object b2 = arguments[1].get();
    EWAHCompressedBitmap bitmap1 = wordArrayToBitmap(b1);
    EWAHCompressedBitmap bitmap2 = wordArrayToBitmap(b2);
    EWAHCompressedBitmap bitmapAnd = bitmapBop(bitmap1, bitmap2);
    BitmapObjectOutput bitmapObjOut = new BitmapObjectOutput();
    try {
        bitmapAnd.writeExternal(bitmapObjOut);
    } catch (IOException e) {
        throw new RuntimeException(e);
    }
    ret.clear();
    List<LongWritable> retList = bitmapToWordArray(bitmapAnd);
    for (LongWritable l : retList) {
        ret.add(l);
    }
    return ret;
}
Also used : BitmapObjectOutput(org.apache.hadoop.hive.ql.index.bitmap.BitmapObjectOutput) EWAHCompressedBitmap(javaewah.EWAHCompressedBitmap) IOException(java.io.IOException) LongWritable(org.apache.hadoop.io.LongWritable)

Aggregations

IOException (java.io.IOException)1 EWAHCompressedBitmap (javaewah.EWAHCompressedBitmap)1 BitmapObjectOutput (org.apache.hadoop.hive.ql.index.bitmap.BitmapObjectOutput)1 LongWritable (org.apache.hadoop.io.LongWritable)1