- All Superinterfaces:
org.apache.lucene.util.Accountable,AutoCloseable,Closeable,org.elasticsearch.core.RefCounted,org.elasticsearch.core.Releasable
- All Known Subinterfaces:
BooleanVector,BytesRefVector,DoubleVector,FloatVector,IntVector,LongVector
- All Known Implementing Classes:
BooleanBigArrayVector,ConstantNullVector,DocVector,DoubleBigArrayVector,FloatBigArrayVector,IntBigArrayVector,LongBigArrayVector,OrdinalBytesRefVector
public interface Vector
extends org.apache.lucene.util.Accountable, org.elasticsearch.core.RefCounted, org.elasticsearch.core.Releasable
A dense Vector of single values.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final bytestatic final bytestatic final bytestatic final bytestatic final byteThe serialization type of vectors: 0 and 1 replaces the boolean false/true in pre-8.14.Fields inherited from interface org.apache.lucene.util.Accountable
NULL_ACCOUNTABLEFields inherited from interface org.elasticsearch.core.RefCounted
ALWAYS_REFERENCED -
Method Summary
Modifier and TypeMethodDescriptionvoidBefore 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.asBlock()Returns Returns a new Block containing this vector..The block factory associated with this vector.Returns the element type of this vector.filter(int... positions) Creates a new vector that only exposes the positions provided.intThe number of positions in this vector.booleanReturns true iff this vector is a constant vector - returns the same constant value for every position.booleanWhether this vector was releasedkeepMask(BooleanVector mask) org.elasticsearch.core.ReleasableIterator<? extends Block> lookup(IntBlock positions, ByteSizeValue targetBlockSize) Builds an Iterator of newBlocks with the sameelementType()as thisVectorwhose values are copied from positions in this Vector.Methods inherited from interface org.apache.lucene.util.Accountable
getChildResources, ramBytesUsedMethods inherited from interface org.elasticsearch.core.RefCounted
decRef, hasReferences, incRef, mustIncRef, tryIncRefMethods inherited from interface org.elasticsearch.core.Releasable
close
-
Field Details
-
SERIALIZE_VECTOR_VALUES
static final byte SERIALIZE_VECTOR_VALUESThe serialization type of vectors: 0 and 1 replaces the boolean false/true in pre-8.14.- See Also:
-
SERIALIZE_VECTOR_CONSTANT
static final byte SERIALIZE_VECTOR_CONSTANT- See Also:
-
SERIALIZE_VECTOR_ARRAY
static final byte SERIALIZE_VECTOR_ARRAY- See Also:
-
SERIALIZE_VECTOR_BIG_ARRAY
static final byte SERIALIZE_VECTOR_BIG_ARRAY- See Also:
-
SERIALIZE_VECTOR_ORDINAL
static final byte SERIALIZE_VECTOR_ORDINAL- See Also:
-
-
Method Details
-
asBlock
Block asBlock()Returns Returns a new Block containing this vector..- Returns:
- Returns a new Block containing this vector.
-
getPositionCount
int getPositionCount()The number of positions in this vector.- Returns:
- the number of positions
-
filter
Creates a new vector that only exposes the positions provided. Materialization of the selected positions is avoided.- Parameters:
positions- the positions to retain- Returns:
- a filtered vector
-
keepMask
-
lookup
org.elasticsearch.core.ReleasableIterator<? extends Block> lookup(IntBlock positions, ByteSizeValue targetBlockSize) Builds an Iterator of newBlocks with the sameelementType()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. -
elementType
ElementType elementType()Returns the element type of this vector.- Returns:
- the element type of this vector
-
isConstant
boolean isConstant()Returns true iff this vector is a constant vector - returns the same constant value for every position.- Returns:
- true iff this vector is a constant vector - returns the same constant value for every position
-
blockFactory
BlockFactory blockFactory()The block factory associated with this vector. -
allowPassingToDifferentDriver
void allowPassingToDifferentDriver()Before 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. -
isReleased
boolean isReleased()Whether this vector was released
-