Class AbstractArrowBufVector<V extends Vector,B extends Block>

java.lang.Object
org.elasticsearch.compute.data.AbstractNonThreadSafeRefCounted
org.elasticsearch.compute.data.arrow.AbstractArrowBufVector<V,B>
All Implemented Interfaces:
Closeable, AutoCloseable, org.apache.lucene.util.Accountable, Vector, org.elasticsearch.core.RefCounted, org.elasticsearch.core.Releasable
Direct Known Subclasses:
BooleanArrowBufVector, BytesRefArrowBufVector, DoubleArrowBufVector, Float16ArrowBufVector, FloatArrowBufVector, Int16ArrowBufVector, Int8ArrowBufVector, IntArrowBufVector, LongArrowBufVector, LongMul1kArrowBufVector, UInt16ArrowBufVector, UInt32ArrowBufVector, UInt8ArrowBufVector

public abstract class AbstractArrowBufVector<V extends Vector,B extends Block> extends AbstractNonThreadSafeRefCounted implements Vector
  • Field Details

    • valueBuffer

      protected final org.apache.arrow.memory.ArrowBuf valueBuffer
    • positionCount

      protected final int positionCount
    • blockFactory

      protected final BlockFactory blockFactory
    • closed

      protected boolean closed
  • Constructor Details

    • AbstractArrowBufVector

      protected AbstractArrowBufVector(org.apache.arrow.memory.ArrowBuf valueBuffer, int positionCount, BlockFactory blockFactory)
      Create an ArrowBuf ES|QL vector based on the constituents of an Arrow ValueVector. The caller must retain the buffer if it's shared with other blocks or Arrow vectors.
    • AbstractArrowBufVector

      protected AbstractArrowBufVector(org.apache.arrow.vector.FixedWidthVector arrowVector, BlockFactory blockFactory)
  • Method Details

    • retainBuffers

      public void retainBuffers()
      Retains (increments the reference count) this vector's Arrow buffers
    • releaseBuffers

      public void releaseBuffers()
      Releases (decrements the reference count) this vector's Arrow buffers
    • byteSize

      protected abstract int byteSize()
    • vectorConstructor

      protected abstract ArrowBufVectorConstructor<V> vectorConstructor()
    • blockConstructor

      protected abstract ArrowBufBlockConstructor<B> blockConstructor()
    • closeInternal

      protected void closeInternal()
      Description copied from class: AbstractNonThreadSafeRefCounted
      This is called when the number of references reaches zero. This is where resources should be released (adjusting circuit breakers if needed).
      Specified by:
      closeInternal in class AbstractNonThreadSafeRefCounted
    • getPositionCount

      public int getPositionCount()
      Description copied from interface: Vector
      Returns the number of positions (rows) in this vector. See class javadoc for the usual way to iterate these positions.
      Specified by:
      getPositionCount in interface Vector
      Returns:
      the number of positions (rows) in this vector
    • isConstant

      public boolean isConstant()
      Description copied from interface: Vector
      Returns true iff this vector is a constant vector - returns the same constant value for every position.
      Specified by:
      isConstant in interface Vector
      Returns:
      true iff this vector is a constant vector - returns the same constant value for every position
    • blockFactory

      public BlockFactory blockFactory()
      Description copied from interface: Vector
      The block factory associated with this vector.
      Specified by:
      blockFactory in interface Vector
    • allowPassingToDifferentDriver

      public void allowPassingToDifferentDriver()
      Description copied from interface: Vector
      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.
      Specified by:
      allowPassingToDifferentDriver in interface Vector
    • asBlock

      public B asBlock()
      Description copied from interface: Vector
      Returns a new Block containing this vector.
      Specified by:
      asBlock in interface Vector
      Returns:
      a new Block containing this vector
    • keepMask

      public B keepMask(BooleanVector mask)
      Description copied from interface: Vector
      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.
      Specified by:
      keepMask in interface Vector
    • ramBytesUsed

      public long ramBytesUsed()
      Specified by:
      ramBytesUsed in interface org.apache.lucene.util.Accountable
    • filter

      public V filter(boolean mayContainDuplicates, int... positions)
      Description copied from interface: Vector
      Creates a new vector that only exposes the positions provided. Materialization of the selected positions is avoided.
      Specified by:
      filter in interface Vector
      Parameters:
      mayContainDuplicates - may the positions array contain duplicate positions?
      positions - the positions to retain
      Returns:
      a filtered vector