Module org.elasticsearch.compute
Class BytesRefArrowBufVector
java.lang.Object
org.elasticsearch.compute.data.AbstractNonThreadSafeRefCounted
org.elasticsearch.compute.data.arrow.AbstractArrowBufVector<BytesRefVector,BytesRefBlock>
org.elasticsearch.compute.data.arrow.BytesRefArrowBufVector
- All Implemented Interfaces:
Closeable,AutoCloseable,org.apache.lucene.util.Accountable,BytesRefVector,Vector,org.elasticsearch.core.RefCounted,org.elasticsearch.core.Releasable
public final class BytesRefArrowBufVector
extends AbstractArrowBufVector<BytesRefVector,BytesRefBlock>
implements BytesRefVector
Arrow buffer backed
BytesRefVector. Variable-length values use an additional offsets buffer
that maps each value index to a byte range in the data buffer.-
Nested Class Summary
Nested classes/interfaces inherited from interface org.elasticsearch.compute.data.BytesRefVector
BytesRefVector.BuilderNested 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
ConstructorsConstructorDescriptionBytesRefArrowBufVector(org.apache.arrow.memory.ArrowBuf valueBuffer, org.apache.arrow.memory.ArrowBuf valueOffsetsBuffer, int positionCount, BlockFactory blockFactory) -
Method Summary
Modifier and TypeMethodDescriptionasBlock()Returns a new Block containing this vector.Returns an ordinal BytesRef vector if this vector is backed by a dictionary and ordinals; otherwise, returns null.protected ArrowBufBlockConstructor<BytesRefBlock> protected intbyteSize()Returns the element type of this vector.booleanCompares the given object with this vector for equality.filter(boolean mayContainDuplicates, int... positions) Creates a new vector that only exposes the positions provided.org.apache.lucene.util.BytesRefgetBytesRef(int position, org.apache.lucene.util.BytesRef dest) inthashCode()Returns the hash code of this vector, as defined byBytesRefVector.hash(BytesRefVector).org.elasticsearch.core.ReleasableIterator<BytesRefBlock> 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 BytesRefArrowBufVectorof(org.apache.arrow.vector.VarCharVector arrowVec, BlockFactory blockFactory) longvoidReleases (decrements the reference count) this vector's Arrow buffersvoidRetains (increments the reference count) this vector's Arrow buffersslice(int beginInclusive, int endExclusive) Return a subset of this vector frombeginInclusivetoendExclusive.protected ArrowBufVectorConstructor<BytesRefVector> voidwriteTo(StreamOutput out) Serializes this Vector to the given stream output.Methods inherited from class org.elasticsearch.compute.data.arrow.AbstractArrowBufVector
allowPassingToDifferentDriver, blockFactory, closeInternal, getPositionCount, isConstant, keepMaskMethods inherited from class org.elasticsearch.compute.data.AbstractNonThreadSafeRefCounted
close, decRef, hasReferences, incRef, isReleased, tryIncRefMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.lucene.util.Accountable
getChildResourcesMethods inherited from interface org.elasticsearch.compute.data.BytesRefVector
deepCopy, 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, blockFactory, getPositionCount, isConstant, isReleased
-
Constructor Details
-
BytesRefArrowBufVector
public BytesRefArrowBufVector(org.apache.arrow.memory.ArrowBuf valueBuffer, org.apache.arrow.memory.ArrowBuf valueOffsetsBuffer, int positionCount, BlockFactory blockFactory)
-
-
Method Details
-
of
public static BytesRefArrowBufVector of(org.apache.arrow.vector.VarCharVector arrowVec, BlockFactory blockFactory) -
vectorConstructor
- Specified by:
vectorConstructorin classAbstractArrowBufVector<BytesRefVector,BytesRefBlock>
-
blockConstructor
- Specified by:
blockConstructorin classAbstractArrowBufVector<BytesRefVector,BytesRefBlock>
-
retainBuffers
public void retainBuffers()Description copied from class:AbstractArrowBufVectorRetains (increments the reference count) this vector's Arrow buffers- Overrides:
retainBuffersin classAbstractArrowBufVector<BytesRefVector,BytesRefBlock>
-
releaseBuffers
public void releaseBuffers()Description copied from class:AbstractArrowBufVectorReleases (decrements the reference count) this vector's Arrow buffers- Overrides:
releaseBuffersin classAbstractArrowBufVector<BytesRefVector,BytesRefBlock>
-
getBytesRef
public org.apache.lucene.util.BytesRef getBytesRef(int position, org.apache.lucene.util.BytesRef dest) - Specified by:
getBytesRefin interfaceBytesRefVector
-
byteSize
protected int byteSize()- Specified by:
byteSizein classAbstractArrowBufVector<BytesRefVector,BytesRefBlock>
-
elementType
Description copied from interface:VectorReturns the element type of this vector.- Specified by:
elementTypein interfaceVector- Returns:
- the element type of this vector
-
asOrdinals
Description copied from interface:BytesRefVectorReturns an ordinal BytesRef vector if this vector is backed by a dictionary and ordinals; otherwise, returns null. Callers must not release the returned vector as no extra reference is retained by this method.- Specified by:
asOrdinalsin interfaceBytesRefVector
-
asBlock
Description copied from interface:VectorReturns a new Block containing this vector.- Specified by:
asBlockin interfaceBytesRefVector- Specified by:
asBlockin interfaceVector- Overrides:
asBlockin classAbstractArrowBufVector<BytesRefVector,BytesRefBlock> - Returns:
- a new Block containing this vector
-
ramBytesUsed
public long ramBytesUsed()- Specified by:
ramBytesUsedin interfaceorg.apache.lucene.util.Accountable- Overrides:
ramBytesUsedin classAbstractArrowBufVector<BytesRefVector,BytesRefBlock>
-
slice
Description copied from interface:BytesRefVectorReturn 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 interfaceBytesRefVector- Specified by:
slicein interfaceVector
-
lookup
public org.elasticsearch.core.ReleasableIterator<BytesRefBlock> lookup(IntBlock positions, ByteSizeValue targetBlockSize) 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 interfaceBytesRefVector- 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 interfaceBytesRefVector- Specified by:
filterin interfaceVector- Overrides:
filterin classAbstractArrowBufVector<BytesRefVector,BytesRefBlock> - Parameters:
mayContainDuplicates- may the positions array contain duplicate positions?positions- the positions to retain- Returns:
- a filtered vector
-
writeTo
Description copied from interface:BytesRefVectorSerializes this Vector to the given stream output.- Specified by:
writeToin interfaceBytesRefVector- Throws:
IOException
-
equals
Description copied from interface:BytesRefVectorCompares the given object with this vector for equality. Returnstrueif and only if the given object is a BytesRefVector, and both vectors areequal.- Specified by:
equalsin interfaceBytesRefVector- Overrides:
equalsin classObject
-
hashCode
public int hashCode()Description copied from interface:BytesRefVectorReturns the hash code of this vector, as defined byBytesRefVector.hash(BytesRefVector).- Specified by:
hashCodein interfaceBytesRefVector- Overrides:
hashCodein classObject
-