Class RoaringBitmapSliceIndex

  • All Implemented Interfaces:
    BitmapSliceIndex

    public class RoaringBitmapSliceIndex
    extends java.lang.Object
    implements BitmapSliceIndex
    RoaringBitmapSliceIndex
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void add​(RoaringBitmapSliceIndex otherBsi)  
      int bitCount()  
      RoaringBitmapSliceIndex clone()  
      org.roaringbitmap.RoaringBitmap compare​(BitmapSliceIndex.Operation operation, int startOrValue, int end, org.roaringbitmap.RoaringBitmap foundSet)
      BSI Compare using single thread this Function compose algorithm from O'Neil and Owen Kaser the GE algorithm is from Owen since the performance is better.
      void deserialize​(java.io.DataInput in)  
      void deserialize​(java.nio.ByteBuffer buffer)  
      org.roaringbitmap.RoaringBitmap getExistenceBitmap()
      GetExistenceBitmap returns a pointer to the underlying existence bitmap of the BSI
      long getLongCardinality()  
      Pair<java.lang.Integer,​java.lang.Boolean> getValue​(int columnId)
      GetValue gets the value at the column ID.
      boolean hasRunCompression()
      hasRunCompression returns true if the bitmap benefits from run compression
      void merge​(RoaringBitmapSliceIndex otherBsi)
      merge will merge 2 bsi into current merge API was designed for distributed computing note: current and other bsi has no intersection
      void runOptimize()
      RunOptimize attempts to further compress the runs of consecutive values found in the bitmap
      void serialize​(java.io.DataOutput output)  
      void serialize​(java.nio.ByteBuffer buffer)  
      int serializedSizeInBytes()  
      void setValue​(int columnId, int value)
      SetValue sets a value for a given columnID.
      void setValues​(java.util.List<Pair<java.lang.Integer,​java.lang.Integer>> values, java.lang.Integer currentMaxValue, java.lang.Integer currentMinValue)
      setValues will batch set value for this bsi.
      Pair<java.lang.Long,​java.lang.Long> sum​(org.roaringbitmap.RoaringBitmap foundSet)  
      boolean valueExist​(java.lang.Long columnId)
      valueExists tests whether the value exists.
      • Methods inherited from class java.lang.Object

        equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • RoaringBitmapSliceIndex

        public RoaringBitmapSliceIndex​(int minValue,
                                       int maxValue)
        NewBSI constructs a new BSI. Min/Max values are optional. If set to 0 then the underlying BSI will be automatically sized.
      • RoaringBitmapSliceIndex

        public RoaringBitmapSliceIndex()
        NewDefaultBSI constructs an auto-sized BSI
    • Method Detail

      • runOptimize

        public void runOptimize()
        RunOptimize attempts to further compress the runs of consecutive values found in the bitmap
      • hasRunCompression

        public boolean hasRunCompression()
        hasRunCompression returns true if the bitmap benefits from run compression
      • getExistenceBitmap

        public org.roaringbitmap.RoaringBitmap getExistenceBitmap()
        GetExistenceBitmap returns a pointer to the underlying existence bitmap of the BSI
      • getValue

        public Pair<java.lang.Integer,​java.lang.Boolean> getValue​(int columnId)
        GetValue gets the value at the column ID. Second param will be false for non-existence values.
        Specified by:
        getValue in interface BitmapSliceIndex
        Parameters:
        columnId - columnId or rowId
        Returns:
        the value of this columnId
      • serialize

        public void serialize​(java.io.DataOutput output)
                       throws java.io.IOException
        Specified by:
        serialize in interface BitmapSliceIndex
        Throws:
        java.io.IOException
      • deserialize

        public void deserialize​(java.io.DataInput in)
                         throws java.io.IOException
        Throws:
        java.io.IOException
      • deserialize

        public void deserialize​(java.nio.ByteBuffer buffer)
                         throws java.io.IOException
        Throws:
        java.io.IOException
      • valueExist

        public boolean valueExist​(java.lang.Long columnId)
        valueExists tests whether the value exists.
      • setValue

        public void setValue​(int columnId,
                             int value)
        SetValue sets a value for a given columnID.
        Specified by:
        setValue in interface BitmapSliceIndex
        Parameters:
        columnId - columnId or rowId
        value - value for this columnId or rowId
      • setValues

        public void setValues​(java.util.List<Pair<java.lang.Integer,​java.lang.Integer>> values,
                              java.lang.Integer currentMaxValue,
                              java.lang.Integer currentMinValue)
        Description copied from interface: BitmapSliceIndex
        setValues will batch set value for this bsi. currentMaxValue/currentMinValue are optional,it's can be compute from input value list. and avoiding bsi expend slice array capacity.
        Specified by:
        setValues in interface BitmapSliceIndex
      • merge

        public void merge​(RoaringBitmapSliceIndex otherBsi)
        merge will merge 2 bsi into current merge API was designed for distributed computing note: current and other bsi has no intersection
        Parameters:
        otherBsi - other bsi we need merge
      • compare

        public org.roaringbitmap.RoaringBitmap compare​(BitmapSliceIndex.Operation operation,
                                                       int startOrValue,
                                                       int end,
                                                       org.roaringbitmap.RoaringBitmap foundSet)
        BSI Compare using single thread this Function compose algorithm from O'Neil and Owen Kaser the GE algorithm is from Owen since the performance is better. others are from O'Neil
        Parameters:
        operation -
        startOrValue - the start or value of comparison, when the comparison operation is range, it's start, when others,it's value.
        end - the end value of comparison. when the comparison operation is not range,the end = 0
        foundSet - columnId set we want compare,using RoaringBitmap to express
        Returns:
        columnId set we found in this bsi with giving conditions, using RoaringBitmap to express
      • sum

        public Pair<java.lang.Long,​java.lang.Long> sum​(org.roaringbitmap.RoaringBitmap foundSet)