Package org.roaringbitmap.bsi
Class RoaringBitmapSliceIndex
- java.lang.Object
-
- org.roaringbitmap.bsi.RoaringBitmapSliceIndex
-
- All Implemented Interfaces:
BitmapSliceIndex
public class RoaringBitmapSliceIndex extends java.lang.Object implements BitmapSliceIndex
RoaringBitmapSliceIndex
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.roaringbitmap.bsi.BitmapSliceIndex
BitmapSliceIndex.Operation
-
-
Constructor Summary
Constructors Constructor Description RoaringBitmapSliceIndex()NewDefaultBSI constructs an auto-sized BSIRoaringBitmapSliceIndex(int minValue, int maxValue)NewBSI constructs a new BSI.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(RoaringBitmapSliceIndex otherBsi)intbitCount()RoaringBitmapSliceIndexclone()org.roaringbitmap.RoaringBitmapcompare(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.voiddeserialize(java.io.DataInput in)voiddeserialize(java.nio.ByteBuffer buffer)org.roaringbitmap.RoaringBitmapgetExistenceBitmap()GetExistenceBitmap returns a pointer to the underlying existence bitmap of the BSIlonggetLongCardinality()Pair<java.lang.Integer,java.lang.Boolean>getValue(int columnId)GetValue gets the value at the column ID.booleanhasRunCompression()hasRunCompression returns true if the bitmap benefits from run compressionvoidmerge(RoaringBitmapSliceIndex otherBsi)merge will merge 2 bsi into current merge API was designed for distributed computing note: current and other bsi has no intersectionvoidrunOptimize()RunOptimize attempts to further compress the runs of consecutive values found in the bitmapvoidserialize(java.io.DataOutput output)voidserialize(java.nio.ByteBuffer buffer)intserializedSizeInBytes()voidsetValue(int columnId, int value)SetValue sets a value for a given columnID.voidsetValues(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)booleanvalueExist(java.lang.Long columnId)valueExists tests whether the value exists.
-
-
-
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
-
add
public void add(RoaringBitmapSliceIndex otherBsi)
-
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
-
bitCount
public int bitCount()
- Specified by:
bitCountin interfaceBitmapSliceIndex
-
getLongCardinality
public long getLongCardinality()
- Specified by:
getLongCardinalityin interfaceBitmapSliceIndex
-
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:
getValuein interfaceBitmapSliceIndex- 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:
serializein interfaceBitmapSliceIndex- Throws:
java.io.IOException
-
deserialize
public void deserialize(java.io.DataInput in) throws java.io.IOException- Throws:
java.io.IOException
-
serialize
public void serialize(java.nio.ByteBuffer buffer)
- Specified by:
serializein interfaceBitmapSliceIndex
-
deserialize
public void deserialize(java.nio.ByteBuffer buffer) throws java.io.IOException- Throws:
java.io.IOException
-
serializedSizeInBytes
public int serializedSizeInBytes()
- Specified by:
serializedSizeInBytesin interfaceBitmapSliceIndex
-
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:
setValuein interfaceBitmapSliceIndex- Parameters:
columnId- columnId or rowIdvalue- 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:BitmapSliceIndexsetValues 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:
setValuesin interfaceBitmapSliceIndex
-
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
-
clone
public RoaringBitmapSliceIndex clone()
- Overrides:
clonein classjava.lang.Object
-
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 = 0foundSet- 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)
-
-