Module org.elasticsearch.compute
Class BooleanArrowBufVector
java.lang.Object
org.elasticsearch.compute.data.AbstractNonThreadSafeRefCounted
org.elasticsearch.compute.data.arrow.AbstractArrowBufVector<BooleanVector,BooleanBlock>
org.elasticsearch.compute.data.arrow.BooleanArrowBufVector
- All Implemented Interfaces:
Closeable,AutoCloseable,org.apache.lucene.util.Accountable,BooleanVector,Vector,RefCounted,Releasable
public final class BooleanArrowBufVector
extends AbstractArrowBufVector<BooleanVector,BooleanBlock>
implements BooleanVector
Arrow buffer backed
BooleanVector. Booleans are bit-packed in Arrow (1 bit per value),
so this class overrides filter(boolean, int[], int, int) with a bit-level implementation.-
Nested Class Summary
Nested classes/interfaces inherited from interface org.elasticsearch.compute.data.BooleanVector
BooleanVector.Builder, BooleanVector.FixedBuilderNested classes/interfaces inherited from interface org.elasticsearch.compute.data.Vector
Vector.Builder -
Field Summary
Fields inherited from class org.elasticsearch.compute.data.arrow.AbstractArrowBufVector
blockFactory, closed, positionCount, valueBufferFields inherited from interface org.apache.lucene.util.Accountable
NULL_ACCOUNTABLEFields inherited from interface org.elasticsearch.core.RefCounted
ALWAYS_REFERENCEDFields inherited from interface org.elasticsearch.compute.data.Vector
SERIALIZE_VECTOR_ARRAY, SERIALIZE_VECTOR_BIG_ARRAY, SERIALIZE_VECTOR_CONSTANT, SERIALIZE_VECTOR_ORDINAL, SERIALIZE_VECTOR_VALUES -
Constructor Summary
ConstructorsConstructorDescriptionBooleanArrowBufVector(org.apache.arrow.memory.ArrowBuf valueBuffer, int positionCount, BlockFactory blockFactory) -
Method Summary
Modifier and TypeMethodDescriptionbooleanallFalse()Are all valuesfalse? This will scan all values to check and always answer accurately.booleanallTrue()Are all valuestrue? This will scan all values to check and always answer accurately.protected ArrowBufBlockConstructor<BooleanBlock> protected intbyteSize()Returns the element type of this vector.filter(boolean mayContainDuplicates, int[] positions, int offset, int length) Creates a new vector that only exposes the positions provided.booleangetBoolean(int position) lookup(IntBlock positions, ByteSizeValue targetBlockSize) Builds an Iterator of newBlocks with the sameVector.elementType()as thisVectorwhose values are copied from positions in this Vector.static BooleanArrowBufVectorof(org.apache.arrow.vector.BitVector bitVector, BlockFactory blockFactory) slice(int beginInclusive, int endExclusive) Return a subset of this vector frombeginInclusivetoendExclusive.intThe maximum size in bytes of any single value stored in this vector, or0if there are no values.protected ArrowBufVectorConstructor<BooleanVector> voidwriteTo(StreamOutput out) Serializes this Vector to the given stream output.Methods inherited from class org.elasticsearch.compute.data.arrow.AbstractArrowBufVector
allowPassingToDifferentDriver, asBlock, blockFactory, closeInternal, getPositionCount, isConstant, keepMask, ramBytesUsed, releaseBuffers, retainBuffers, valuesSegmentMethods inherited from class org.elasticsearch.compute.data.AbstractNonThreadSafeRefCounted
attachReleasable, close, decRef, hasReferences, incRef, isReleased, tryIncRefMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.lucene.util.Accountable
getChildResources, ramBytesUsedMethods inherited from interface org.elasticsearch.compute.data.BooleanVector
asBlock, copyTo, deepCopy, equals, filter, hashCode, keepMaskMethods inherited from interface org.elasticsearch.core.RefCounted
decRef, hasReferences, incRef, mustIncRef, tryIncRefMethods inherited from interface org.elasticsearch.core.Releasable
closeMethods inherited from interface org.elasticsearch.compute.data.Vector
allowPassingToDifferentDriver, attachReleasable, blockFactory, getPositionCount, isConstant, isReleased
-
Constructor Details
-
BooleanArrowBufVector
public BooleanArrowBufVector(org.apache.arrow.memory.ArrowBuf valueBuffer, int positionCount, BlockFactory blockFactory)
-
-
Method Details
-
of
public static BooleanArrowBufVector of(org.apache.arrow.vector.BitVector bitVector, BlockFactory blockFactory) -
vectorConstructor
- Specified by:
vectorConstructorin classAbstractArrowBufVector<BooleanVector,BooleanBlock>
-
blockConstructor
- Specified by:
blockConstructorin classAbstractArrowBufVector<BooleanVector,BooleanBlock>
-
getBoolean
public boolean getBoolean(int position) - Specified by:
getBooleanin interfaceBooleanVector
-
byteSize
protected int byteSize()- Specified by:
byteSizein classAbstractArrowBufVector<BooleanVector,BooleanBlock>
-
elementType
Description copied from interface:VectorReturns the element type of this vector.- Specified by:
elementTypein interfaceVector- Returns:
- the element type of this vector
-
valueMaxByteSize
public int valueMaxByteSize()Description copied from interface:BooleanVectorThe maximum size in bytes of any single value stored in this vector, or0if there are no values. AlwaysByte.BYTESsince all boolean values encode to the same number of bytes.- Specified by:
valueMaxByteSizein interfaceBooleanVector- Specified by:
valueMaxByteSizein interfaceVector- Returns:
- the maximum byte size of any single value in this vector
-
allTrue
public boolean allTrue()Description copied from interface:BooleanVectorAre all valuestrue? This will scan all values to check and always answer accurately.- Specified by:
allTruein interfaceBooleanVector
-
allFalse
public boolean allFalse()Description copied from interface:BooleanVectorAre all valuesfalse? This will scan all values to check and always answer accurately.- Specified by:
allFalsein interfaceBooleanVector
-
slice
Description copied from interface:BooleanVectorReturn a subset of this vector frombeginInclusivetoendExclusive. This may return the same instance if the range covers all positions, but if it does it willRefCounted.incRef()it.- Specified by:
slicein interfaceBooleanVector- Specified by:
slicein interfaceVector
-
lookup
Description copied from interface:VectorBuilds an Iterator of newBlocks with the sameVector.elementType()as thisVectorwhose values are copied from positions in this Vector. It has the same number ofpositionsas thepositionsparameter.For example, if this vector contained
[a, b, c]and were called with the block[0, 1, 1, [1, 2]]then the result would be[a, b, b, [b, c]].This process produces
count(positions)values per positions which could be quite large. Instead of returning a single Block, this returns an Iterator of Blocks containing all of the promised values.The returned
ReleasableIteratormay retain a reference to thepositionsparameter. Close it to release those references.This block is built using the same
BlockFactoryas was used to build thepositionsparameter.- Specified by:
lookupin interfaceBooleanVector- Specified by:
lookupin interfaceVector
-
filter
Description copied from interface:VectorCreates a new vector that only exposes the positions provided. Materialization of the selected positions is avoided.- Specified by:
filterin interfaceBooleanVector- Specified by:
filterin interfaceVector- Overrides:
filterin classAbstractArrowBufVector<BooleanVector,BooleanBlock> - Parameters:
mayContainDuplicates- may the positions array contain duplicate positions?positions- the positions arrayoffset- the start index in the positions arraylength- the number of positions to use from the array- Returns:
- a filtered vector
-
writeTo
Description copied from interface:BooleanVectorSerializes this Vector to the given stream output.- Specified by:
writeToin interfaceBooleanVector- Throws:
IOException
-