java.lang.Object
org.elasticsearch.compute.data.AbstractNonThreadSafeRefCounted
org.elasticsearch.compute.data.ConstantNullVector
- All Implemented Interfaces:
Closeable,AutoCloseable,org.apache.lucene.util.Accountable,BooleanVector,BytesRefVector,DoubleVector,FloatVector,IntVector,LongVector,Vector,org.elasticsearch.core.RefCounted,org.elasticsearch.core.Releasable
public final class ConstantNullVector
extends AbstractNonThreadSafeRefCounted
implements BooleanVector, BytesRefVector, DoubleVector, FloatVector, IntVector, LongVector
This vector is never instantiated. This class serves as a type holder for
ConstantNullBlock.asVector().-
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.BytesRefVector
BytesRefVector.BuilderNested classes/interfaces inherited from interface org.elasticsearch.compute.data.DoubleVector
DoubleVector.Builder, DoubleVector.FixedBuilderNested classes/interfaces inherited from interface org.elasticsearch.compute.data.FloatVector
FloatVector.Builder, FloatVector.FixedBuilderNested classes/interfaces inherited from interface org.elasticsearch.compute.data.IntVector
IntVector.Builder, IntVector.FixedBuilderNested classes/interfaces inherited from interface org.elasticsearch.compute.data.LongVector
LongVector.Builder, LongVector.FixedBuilderNested classes/interfaces inherited from interface org.elasticsearch.compute.data.Vector
Vector.Builder -
Field Summary
Fields 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 -
Method Summary
Modifier and TypeMethodDescriptionbooleanallFalse()Are all valuesfalse? This will scan all values to check and always answer accurately.voidBefore passing a Vector to another Driver, it is necessary to switch the owning block factory to its parent, which is associated with the global circuit breaker.booleanallTrue()Are all valuestrue? This will scan all values to check and always answer accurately.asBlock()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.The block factory associated with this vector.protected voidThis is called when the number of references reaches zero.voidcopyTo(int srcPosition, boolean[] dst, int dstPosition, int length) Copies values from this vector into the destination array.voidcopyTo(int srcPosition, double[] dst, int dstPosition, int length) Copies values from this vector into the destination array.voidcopyTo(int srcPosition, float[] dst, int dstPosition, int length) Copies values from this vector into the destination array.voidcopyTo(int srcPosition, int[] dst, int dstPosition, int length) Copies values from this vector into the destination array.voidcopyTo(int srcPosition, long[] dst, int dstPosition, int length) Copies values from this vector into the destination array.deepCopy(BlockFactory blockFactory) Make a deep copy of thisVectorusing the providedBlockFactory, likely copying all data.Returns the element type of this vector.filter(boolean mayContainDuplicates, int... positions) Creates a new vector that only exposes the positions provided.booleangetBoolean(int position) org.apache.lucene.util.BytesRefgetBytesRef(int position, org.apache.lucene.util.BytesRef dest) doublegetDouble(int position) floatgetFloat(int position) intgetInt(int position) longgetLong(int position) final intReturns the number of positions (rows) in this vector.booleanReturns true iff this vector is a constant vector - returns the same constant value for every position.keepMask(BooleanVector mask) org.elasticsearch.core.ReleasableIterator<ConstantNullBlock> lookup(IntBlock positions, ByteSizeValue targetBlockSize) Builds an Iterator of newBlocks with the sameVector.elementType()as thisVectorwhose values are copied from positions in this Vector.intmax()The maximum value in the Vector.intmin()The minimum value in the Vector.longslice(int beginInclusive, int endExclusive) Return a subset of this vector frombeginInclusivetoendExclusive.voidwriteTo(StreamOutput out) Serializes this Vector to the given stream output.Methods inherited from class org.elasticsearch.compute.data.AbstractNonThreadSafeRefCounted
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
getChildResourcesMethods inherited from interface org.elasticsearch.compute.data.BooleanVector
equals, hashCodeMethods inherited from interface org.elasticsearch.compute.data.BytesRefVector
equals, hashCodeMethods inherited from interface org.elasticsearch.compute.data.DoubleVector
equals, hashCodeMethods inherited from interface org.elasticsearch.compute.data.FloatVector
equals, hashCodeMethods inherited from interface org.elasticsearch.compute.data.LongVector
equals, hashCodeMethods 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, isReleased
-
Method Details
-
writeTo
Description copied from interface:BooleanVectorSerializes this Vector to the given stream output.- Specified by:
writeToin interfaceBooleanVector- Specified by:
writeToin interfaceBytesRefVector- Specified by:
writeToin interfaceDoubleVector- Specified by:
writeToin interfaceFloatVector- Specified by:
writeToin interfaceIntVector- Specified by:
writeToin interfaceLongVector- Throws:
IOException
-
asBlock
Description copied from interface:VectorReturns a new Block containing this vector.- Specified by:
asBlockin interfaceBooleanVector- Specified by:
asBlockin interfaceBytesRefVector- Specified by:
asBlockin interfaceDoubleVector- Specified by:
asBlockin interfaceFloatVector- Specified by:
asBlockin interfaceIntVector- Specified by:
asBlockin interfaceLongVector- Specified by:
asBlockin interfaceVector- Returns:
- a new Block containing 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
-
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 interfaceBytesRefVector- Specified by:
filterin interfaceDoubleVector- Specified by:
filterin interfaceFloatVector- Specified by:
filterin interfaceIntVector- Specified by:
filterin interfaceLongVector- Specified by:
filterin interfaceVector- Parameters:
mayContainDuplicates- may the positions array contain duplicate positions?positions- the positions to retain- Returns:
- a filtered vector
-
deepCopy
Description copied from interface:BooleanVectorMake a deep copy of thisVectorusing the providedBlockFactory, likely copying all data.- Specified by:
deepCopyin interfaceBooleanVector- Specified by:
deepCopyin interfaceBytesRefVector- Specified by:
deepCopyin interfaceDoubleVector- Specified by:
deepCopyin interfaceFloatVector- Specified by:
deepCopyin interfaceIntVector- Specified by:
deepCopyin interfaceLongVector- Specified by:
deepCopyin interfaceVector
-
keepMask
Description copied from interface:VectorBuild aBlockthe same values as thisVector, but replacing all values for whichmask.getBooleanValue(position)returnsfalsewithnull. Themaskvector must be at least as long as this Vector.- Specified by:
keepMaskin interfaceBooleanVector- Specified by:
keepMaskin interfaceBytesRefVector- Specified by:
keepMaskin interfaceDoubleVector- Specified by:
keepMaskin interfaceFloatVector- Specified by:
keepMaskin interfaceIntVector- Specified by:
keepMaskin interfaceLongVector- Specified by:
keepMaskin interfaceVector
-
lookup
public org.elasticsearch.core.ReleasableIterator<ConstantNullBlock> 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 interfaceBooleanVector- Specified by:
lookupin interfaceBytesRefVector- Specified by:
lookupin interfaceDoubleVector- Specified by:
lookupin interfaceFloatVector- Specified by:
lookupin interfaceIntVector- Specified by:
lookupin interfaceLongVector- Specified by:
lookupin interfaceVector
-
getBoolean
public boolean getBoolean(int position) - Specified by:
getBooleanin interfaceBooleanVector
-
getBytesRef
public org.apache.lucene.util.BytesRef getBytesRef(int position, org.apache.lucene.util.BytesRef dest) - Specified by:
getBytesRefin interfaceBytesRefVector
-
getFloat
public float getFloat(int position) - Specified by:
getFloatin interfaceFloatVector
-
getDouble
public double getDouble(int position) - Specified by:
getDoublein interfaceDoubleVector
-
getInt
public int getInt(int position) -
getLong
public long getLong(int position) - Specified by:
getLongin interfaceLongVector
-
copyTo
public void copyTo(int srcPosition, long[] dst, int dstPosition, int length) Description copied from interface:LongVectorCopies values from this vector into the destination array.- Specified by:
copyToin interfaceLongVector
-
copyTo
public void copyTo(int srcPosition, int[] dst, int dstPosition, int length) Description copied from interface:IntVectorCopies values from this vector into the destination array. -
copyTo
public void copyTo(int srcPosition, double[] dst, int dstPosition, int length) Description copied from interface:DoubleVectorCopies values from this vector into the destination array.- Specified by:
copyToin interfaceDoubleVector
-
copyTo
public void copyTo(int srcPosition, float[] dst, int dstPosition, int length) Description copied from interface:FloatVectorCopies values from this vector into the destination array.- Specified by:
copyToin interfaceFloatVector
-
copyTo
public void copyTo(int srcPosition, boolean[] dst, int dstPosition, int length) Description copied from interface:BooleanVectorCopies values from this vector into the destination array.- Specified by:
copyToin interfaceBooleanVector
-
min
public int min()Description copied from interface:IntVectorThe minimum value in the Vector. An empty Vector will returnInteger.MAX_VALUE. -
max
public int max()Description copied from interface:IntVectorThe maximum value in the Vector. An empty Vector will returnInteger.MIN_VALUE. -
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 interfaceBytesRefVector- Specified by:
slicein interfaceDoubleVector- Specified by:
slicein interfaceFloatVector- Specified by:
slicein interfaceIntVector- Specified by:
slicein interfaceLongVector- Specified by:
slicein interfaceVector
-
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
-
elementType
Description copied from interface:VectorReturns the element type of this vector.- Specified by:
elementTypein interfaceVector- Returns:
- the element type of this vector
-
isConstant
public boolean isConstant()Description copied from interface:VectorReturns true iff this vector is a constant vector - returns the same constant value for every position.- Specified by:
isConstantin interfaceVector- Returns:
- true iff this vector is a constant vector - returns the same constant value for every position
-
ramBytesUsed
public long ramBytesUsed()- Specified by:
ramBytesUsedin interfaceorg.apache.lucene.util.Accountable
-
getPositionCount
public final int getPositionCount()Description copied from interface:VectorReturns the number of positions (rows) in this vector. See class javadoc for the usual way to iterate these positions.- Specified by:
getPositionCountin interfaceVector- Returns:
- the number of positions (rows) in this vector
-
blockFactory
Description copied from interface:VectorThe block factory associated with this vector.- Specified by:
blockFactoryin interfaceVector
-
allowPassingToDifferentDriver
public void allowPassingToDifferentDriver()Description copied from interface:VectorBefore passing a Vector to another Driver, it is necessary to switch the owning block factory to its parent, which is associated with the global circuit breaker. This ensures that when the new driver releases this Vector, it returns memory directly to the parent block factory instead of the local block factory of this Block. This is important because the local block factory is not thread safe and doesn't support simultaneous access by more than one thread.- Specified by:
allowPassingToDifferentDriverin interfaceVector
-
closeInternal
protected void closeInternal()Description copied from class:AbstractNonThreadSafeRefCountedThis is called when the number of references reaches zero. This is where resources should be released (adjusting circuit breakers if needed).- Specified by:
closeInternalin classAbstractNonThreadSafeRefCounted
-