Class BaseValueVector

java.lang.Object
org.apache.arrow.vector.BaseValueVector
All Implemented Interfaces:
Closeable, AutoCloseable, Iterable<ValueVector>, ValueVector
Direct Known Subclasses:
BaseFixedWidthVector, BaseLargeRepeatedValueViewVector, BaseLargeVariableWidthVector, BaseRepeatedValueVector, BaseRepeatedValueViewVector, BaseVariableWidthVector, BaseVariableWidthViewVector, ExtensionTypeVector, FixedSizeListVector, LargeListVector, RunEndEncodedVector

public abstract class BaseValueVector extends Object implements ValueVector
Base class for other Arrow Vector Types. Provides basic functionality around memory management.
  • Field Details

    • MAX_ALLOCATION_SIZE_PROPERTY

      public static final String MAX_ALLOCATION_SIZE_PROPERTY
      See Also:
    • MAX_ALLOCATION_SIZE

      public static final long MAX_ALLOCATION_SIZE
    • INITIAL_VALUE_ALLOCATION

      public static final int INITIAL_VALUE_ALLOCATION
      See Also:
    • allocator

      protected final BufferAllocator allocator
    • fieldReader

      protected volatile FieldReader fieldReader
  • Constructor Details

  • Method Details

    • getName

      public abstract String getName()
      Description copied from interface: ValueVector
      Gets the name of the vector.
      Specified by:
      getName in interface ValueVector
      Returns:
      the name of the vector.
    • toString

      public String toString()
      Representation of vector suitable for debugging.
      Overrides:
      toString in class Object
    • clear

      public void clear()
      Description copied from interface: ValueVector
      Release any owned ArrowBuf and reset the ValueVector to the initial state. If the vector has any child vectors, they will also be cleared.
      Specified by:
      clear in interface ValueVector
    • close

      public void close()
      Description copied from interface: ValueVector
      Alternative to clear(). Allows use as an AutoCloseable in try-with-resources.
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Specified by:
      close in interface ValueVector
    • getTransferPair

      public TransferPair getTransferPair(BufferAllocator allocator)
      Description copied from interface: ValueVector
      To transfer quota responsibility.
      Specified by:
      getTransferPair in interface ValueVector
      Parameters:
      allocator - the target allocator
      Returns:
      a transfer pair, creating a new target vector of the same type.
    • iterator

      public Iterator<ValueVector> iterator()
      Specified by:
      iterator in interface Iterable<ValueVector>
    • checkBufRefs

      public static boolean checkBufRefs(ValueVector vv)
      Checks to ensure that every buffer vv uses has a positive reference count, throws if this precondition isn't met. Returns true otherwise.
    • getAllocator

      public BufferAllocator getAllocator()
      Description copied from interface: ValueVector
      Get the allocator associated with the vector. CAVEAT: Some ValueVector subclasses (e.g. NullVector) do not require an allocator for data storage and may return null.
      Specified by:
      getAllocator in interface ValueVector
      Returns:
      Returns nullable allocator.
    • releaseBuffer

      protected ArrowBuf releaseBuffer(ArrowBuf buffer)
    • getValidityBufferSizeFromCount

      protected static int getValidityBufferSizeFromCount(int valueCount)
    • getReaderImpl

      protected abstract FieldReader getReaderImpl()
      Each vector has a different reader that implements the FieldReader interface. Overridden methods must make sure to return the correct concrete reader implementation.
      Returns:
      Returns a lambda that initializes a reader when called.
    • getReader

      public FieldReader getReader()
      Default implementation to create a reader for the vector. Depends on the individual vector class' implementation of getReaderImpl() to initialize the reader appropriately.
      Specified by:
      getReader in interface ValueVector
      Returns:
      Concrete instance of FieldReader by using double-checked locking.
    • transferBuffer

      public static ArrowBuf transferBuffer(ArrowBuf srcBuffer, BufferAllocator targetAllocator)
    • copyFrom

      public void copyFrom(int fromIndex, int thisIndex, ValueVector from)
      Description copied from interface: ValueVector
      Copy a cell value from a particular index in source vector to a particular position in this vector.
      Specified by:
      copyFrom in interface ValueVector
      Parameters:
      fromIndex - position to copy from in source vector
      thisIndex - position to copy to in this vector
      from - source vector
    • copyFromSafe

      public void copyFromSafe(int fromIndex, int thisIndex, ValueVector from)
      Description copied from interface: ValueVector
      Same as ValueVector.copyFrom(int, int, ValueVector) except that it handles the case when the capacity of the vector needs to be expanded before copy.
      Specified by:
      copyFromSafe in interface ValueVector
      Parameters:
      fromIndex - position to copy from in source vector
      thisIndex - position to copy to in this vector
      from - source vector