Interface Vector

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
    Modifier and Type
    Interface
    Description
    static interface 
    Builds Vectors.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final byte
     
    static final byte
     
    static final byte
     
    static final byte
     
    static final byte
    The 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_ACCOUNTABLE

    Fields inherited from interface org.elasticsearch.core.RefCounted

    ALWAYS_REFERENCED
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    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.
    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.
    int
    The number of positions in this vector.
    boolean
    Returns true iff this vector is a constant vector - returns the same constant value for every position.
    boolean
    Whether this vector was released
    Build a Block the same values as this Vector, but replacing all values for which mask.getBooleanValue(position) returns false with null.
    org.elasticsearch.core.ReleasableIterator<? extends Block>
    lookup(IntBlock positions, ByteSizeValue targetBlockSize)
    Builds an Iterator of new Blocks with the same elementType() as this Vector whose values are copied from positions in this Vector.

    Methods inherited from interface org.apache.lucene.util.Accountable

    getChildResources, ramBytesUsed

    Methods inherited from interface org.elasticsearch.core.RefCounted

    decRef, hasReferences, incRef, mustIncRef, tryIncRef

    Methods inherited from interface org.elasticsearch.core.Releasable

    close
  • Field Details

    • SERIALIZE_VECTOR_VALUES

      static final byte SERIALIZE_VECTOR_VALUES
      The 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

      Vector filter(int... positions)
      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

      Block keepMask(BooleanVector mask)
      Build a Block the same values as this Vector, but replacing all values for which mask.getBooleanValue(position) returns false with null. The mask vector must be at least as long as this Vector.
    • lookup

      org.elasticsearch.core.ReleasableIterator<? extends Block> lookup(IntBlock positions, ByteSizeValue targetBlockSize)
      Builds an Iterator of new Blocks with the same elementType() as this Vector whose values are copied from positions in this Vector. It has the same number of positions as the positions parameter.

      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 ReleasableIterator may retain a reference to the positions parameter. Close it to release those references.

      This block is built using the same BlockFactory as was used to build the positions parameter.

    • 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