Package org.apache.druid.segment.vector
Class BitmapVectorOffset
- java.lang.Object
-
- org.apache.druid.segment.vector.BitmapVectorOffset
-
- All Implemented Interfaces:
ReadableVectorInspector,ReadableVectorOffset,VectorOffset,VectorSizeInspector
public class BitmapVectorOffset extends Object implements VectorOffset
-
-
Field Summary
-
Fields inherited from interface org.apache.druid.segment.vector.ReadableVectorInspector
NULL_ID
-
-
Constructor Summary
Constructors Constructor Description BitmapVectorOffset(int vectorSize, ImmutableBitmap bitmap, int startOffset, int endOffset)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadvance()Advances by one batch.intgetCurrentVectorSize()Returns the current vector size for this cursor.intgetId()Returns an integer that uniquely identifies the current vector.intgetMaxVectorSize()Returns the maximum vector size for this cursor.int[]getOffsets()If "isContiguous" is false, this method returns a batch of offsets.intgetStartOffset()If "isContiguous" is true, this method returns the start offset of the range.booleanisContiguous()Checks if the current batch is a contiguous range or not.booleanisDone()Checks if iteration is "done", meaning the current batch of offsets is empty, and there are no more coming.voidreset()Resets the object back to its original state.
-
-
-
Constructor Detail
-
BitmapVectorOffset
public BitmapVectorOffset(int vectorSize, ImmutableBitmap bitmap, int startOffset, int endOffset)
-
-
Method Detail
-
getId
public int getId()
Description copied from interface:ReadableVectorInspectorReturns an integer that uniquely identifies the current vector. This is useful for caching: it is safe to assume nothing has changed in the vector so long as the id remains the same.- Specified by:
getIdin interfaceReadableVectorInspector
-
advance
public void advance()
Description copied from interface:VectorOffsetAdvances by one batch.- Specified by:
advancein interfaceVectorOffset
-
isDone
public boolean isDone()
Description copied from interface:VectorOffsetChecks if iteration is "done", meaning the current batch of offsets is empty, and there are no more coming.- Specified by:
isDonein interfaceVectorOffset
-
isContiguous
public boolean isContiguous()
Description copied from interface:ReadableVectorOffsetChecks if the current batch is a contiguous range or not. This is only good for one batch at a time, since the same object may return some contiguous batches and some non-contiguous batches. So, callers must check this method each time they want to retrieve the current batch of offsets.- Specified by:
isContiguousin interfaceReadableVectorOffset
-
getMaxVectorSize
public int getMaxVectorSize()
Description copied from interface:VectorSizeInspectorReturns the maximum vector size for this cursor. It will not change for the lifetime of this cursor, and is generally used to allocate scratch arrays for later processing. Will always be greater than zero.- Specified by:
getMaxVectorSizein interfaceVectorSizeInspector
-
getCurrentVectorSize
public int getCurrentVectorSize()
Description copied from interface:VectorSizeInspectorReturns the current vector size for this cursor. Will never be larger than the max size returned byVectorSizeInspector.getMaxVectorSize().- Specified by:
getCurrentVectorSizein interfaceVectorSizeInspector
-
getStartOffset
public int getStartOffset()
Description copied from interface:ReadableVectorOffsetIf "isContiguous" is true, this method returns the start offset of the range. The length of the range is given by "getCurrentVectorSize". Throws an exception if "isContiguous" is false.- Specified by:
getStartOffsetin interfaceReadableVectorOffset
-
getOffsets
public int[] getOffsets()
Description copied from interface:ReadableVectorOffsetIf "isContiguous" is false, this method returns a batch of offsets. The array may be longer than the number of valid offsets, so callers need to check "getCurrentVectorSize" too. Throws an exception if "isContiguous" is true.- Specified by:
getOffsetsin interfaceReadableVectorOffset
-
reset
public void reset()
Description copied from interface:VectorOffsetResets the object back to its original state. Once this is done, iteration can begin anew.- Specified by:
resetin interfaceVectorOffset
-
-