Examples of EWAHCompressedBitmap


Examples of javaewah.EWAHCompressedBitmap

    }

    @Override
    public void reset(AggregationBuffer agg) throws HiveException {

        ((BitmapAgg) agg).bitmap = new EWAHCompressedBitmap();
    }
View Full Code Here

Examples of javaewah.EWAHCompressedBitmap

    public void merge(AggregationBuffer agg, Object partial)
        throws HiveException {
      BitmapAgg myagg = (BitmapAgg) agg;
      ArrayList<LongWritable> partialResult = (ArrayList<LongWritable>) internalMergeOI.getList(partial);
      BitmapObjectInput bitmapObjIn = new BitmapObjectInput(partialResult);
      EWAHCompressedBitmap partialBitmap = new EWAHCompressedBitmap();
      try {
        partialBitmap.readExternal(bitmapObjIn);
      } catch (IOException e) {
        throw new RuntimeException(e);
      }
      myagg.bitmap = myagg.bitmap.or(partialBitmap);
    }
View Full Code Here

Examples of javaewah.EWAHCompressedBitmap

          (PrimitiveObjectInspector) lloi.getListElementObjectInspector());
      bitmapArray.add(new LongWritable(l));
    }

    BitmapObjectInput bitmapObjIn = new BitmapObjectInput(bitmapArray);
    EWAHCompressedBitmap bitmap = new EWAHCompressedBitmap();
    try {
      bitmap.readExternal(bitmapObjIn);
    } catch (IOException e) {
      throw new RuntimeException(e);
    }

     // Add return true only if bitmap is all zeros.
     return new BooleanWritable(!bitmap.iterator().hasNext());
  }
View Full Code Here

Examples of javaewah.EWAHCompressedBitmap

    }

    @Override
    public void reset(AggregationBuffer agg) throws HiveException {

        ((BitmapAgg) agg).bitmap = new EWAHCompressedBitmap();
    }
View Full Code Here

Examples of javaewah.EWAHCompressedBitmap

    public void merge(AggregationBuffer agg, Object partial)
        throws HiveException {
      BitmapAgg myagg = (BitmapAgg) agg;
      ArrayList<LongWritable> partialResult = (ArrayList<LongWritable>) internalMergeOI.getList(partial);
      BitmapObjectInput bitmapObjIn = new BitmapObjectInput(partialResult);
      EWAHCompressedBitmap partialBitmap = new EWAHCompressedBitmap();
      try {
        partialBitmap.readExternal(bitmapObjIn);
      } catch (IOException e) {
        throw new RuntimeException(e);
      }
      myagg.bitmap = myagg.bitmap.or(partialBitmap);
    }
View Full Code Here

Examples of javaewah.EWAHCompressedBitmap

    int block = block(position);
    return block < words.length && (words[block] & mask(position)) != 0;
  }

  final EWAHCompressedBitmap toEWAHCompressedBitmap() {
    EWAHCompressedBitmap compressed = new EWAHCompressedBitmap(
        words.length);
    int runningEmptyWords = 0;
    long lastNonEmptyWord = 0;
    for (long word : words) {
      if (word == 0) {
        runningEmptyWords++;
        continue;
      }

      if (lastNonEmptyWord != 0)
        compressed.add(lastNonEmptyWord);

      if (runningEmptyWords > 0) {
        compressed.addStreamOfEmptyWords(false, runningEmptyWords);
        runningEmptyWords = 0;
      }

      lastNonEmptyWord = word;
    }
    int bitsThatMatter = 64 - Long.numberOfLeadingZeros(lastNonEmptyWord);
    if (bitsThatMatter > 0)
      compressed.add(lastNonEmptyWord, bitsThatMatter);
    return compressed;
  }
View Full Code Here

Examples of javaewah.EWAHCompressedBitmap

    };
  }

  @Override
  public EWAHCompressedBitmap getBitmap(AnyObjectId objectId) {
    EWAHCompressedBitmap bitmap = newPackIndex.getBitmap(objectId);
    if (bitmap != null || oldPackIndex == null)
      return bitmap;

    StoredBitmap stored = convertedBitmaps.get(objectId);
    if (stored != null)
View Full Code Here

Examples of javaewah.EWAHCompressedBitmap

      if (r instanceof EWAHCompressedBitmap)
        return (EWAHCompressedBitmap) r;

      // Expand the bitmap and cache the result.
      XorCompressedBitmap xb = (XorCompressedBitmap) r;
      EWAHCompressedBitmap out = xb.bitmap;
      for (;;) {
        r = xb.xorBitmap.bitmapContainer;
        if (r instanceof EWAHCompressedBitmap) {
          out = out.xor((EWAHCompressedBitmap) r);
          bitmapContainer = out;
          return out;
        }
        xb = (XorCompressedBitmap) r;
        out = out.xor(xb.bitmap);
      }
    }
View Full Code Here

Examples of javaewah.EWAHCompressedBitmap

  public PackBitmapIndexBuilder(List<ObjectToPack> byName) {
    super(new ObjectIdOwnerMap<StoredBitmap>());
    byOffset = sortByOffset(byName);

    int sizeInWords = Math.max(byOffset.length / 64, 4);
    commits = new EWAHCompressedBitmap(sizeInWords);
    trees = new EWAHCompressedBitmap(sizeInWords);
    blobs = new EWAHCompressedBitmap(sizeInWords);
    tags = new EWAHCompressedBitmap(sizeInWords);
    for (int i = 0; i < byOffset.length; i++) {
      int type = byOffset[i].getType();
      switch (type) {
      case Constants.OBJ_COMMIT:
        commits.set(i);
View Full Code Here

Examples of javaewah.EWAHCompressedBitmap

   */
  public void addBitmap(AnyObjectId objectId, Bitmap bitmap, int flags) {
    if (bitmap instanceof BitmapBuilder)
      bitmap = ((BitmapBuilder) bitmap).build();

    EWAHCompressedBitmap compressed;
    if (bitmap instanceof CompressedBitmap)
      compressed = ((CompressedBitmap) bitmap).getEwahCompressedBitmap();
    else
      throw new IllegalArgumentException(bitmap.getClass().toString());

View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.