Class BaseDataValueVector

java.lang.Object
org.apache.drill.exec.vector.BaseValueVector
org.apache.drill.exec.vector.BaseDataValueVector
All Implemented Interfaces:
Closeable, AutoCloseable, Iterable<ValueVector>, ValueVector
Direct Known Subclasses:
BigIntVector, BitVector, DateVector, Decimal18Vector, Decimal28DenseVector, Decimal28SparseVector, Decimal38DenseVector, Decimal38SparseVector, Decimal9Vector, Float4Vector, Float8Vector, IntervalDayVector, IntervalVector, IntervalYearVector, IntVector, NullableBigIntVector, NullableBitVector, NullableDateVector, NullableDecimal18Vector, NullableDecimal28DenseVector, NullableDecimal28SparseVector, NullableDecimal38DenseVector, NullableDecimal38SparseVector, NullableDecimal9Vector, NullableFloat4Vector, NullableFloat8Vector, NullableIntervalDayVector, NullableIntervalVector, NullableIntervalYearVector, NullableIntVector, NullableSmallIntVector, NullableTimeStampVector, NullableTimeVector, NullableTinyIntVector, NullableUInt1Vector, NullableUInt2Vector, NullableUInt4Vector, NullableUInt8Vector, NullableVar16CharVector, NullableVarBinaryVector, NullableVarCharVector, NullableVarDecimalVector, SmallIntVector, TimeStampVector, TimeVector, TinyIntVector, UInt1Vector, UInt2Vector, UInt4Vector, UInt8Vector, UntypedNullVector, Var16CharVector, VarBinaryVector, VarCharVector, VarDecimalVector

public abstract class BaseDataValueVector extends BaseValueVector
  • Field Details

    • emptyByteArray

      protected static final byte[] emptyByteArray
    • data

      protected DrillBuf data
  • Constructor Details

  • Method Details

    • reallocRaw

      public abstract DrillBuf reallocRaw(int newAllocationSize)
      Core of vector allocation. Given a new size (which must be a power of two), allocate the new buffer, copy the current values, and leave the unused parts garbage-filled.
      Parameters:
      newAllocationSize - new buffer size as a power of two
      Returns:
      the new buffer
    • clear

      public void clear()
      Description copied from interface: ValueVector
      Release the underlying DrillBuf and reset the ValueVector to empty.
      Specified by:
      clear in interface ValueVector
      Overrides:
      clear in class BaseValueVector
    • 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
      Overrides:
      close in class BaseValueVector
    • getBuffers

      public DrillBuf[] getBuffers(boolean clear)
      Description copied from interface: ValueVector
      Return the underlying buffers associated with this vector. Note that this doesn't impact the reference counts for this buffer so it only should be used for in-context access. Also note that this buffer changes regularly thus external classes shouldn't hold a reference to it (unless they change it).
      Parameters:
      clear - Whether to clear vector before returning; the buffers will still be refcounted; but the returned array will be the only reference to them
      Returns:
      The underlying buffers that is used by this vector instance.
    • getBufferSize

      public int getBufferSize()
      Description copied from interface: ValueVector
      Returns the number of bytes that is used by this vector instance. This is a bit of a misnomer. Returns the number of bytes used by data in this instance.
    • getAllocatedSize

      public int getAllocatedSize()
      Description copied from interface: ValueVector
      Returns the total size of buffers allocated by this vector. Has meaning only when vectors are directly allocated and each vector has its own buffer. Does not have meaning for vectors deserialized from the network or disk in which multiple vectors share the same vector.
      Returns:
      allocated buffer size, in bytes
    • getBuffer

      public DrillBuf getBuffer()
    • reset

      public void reset()
      This method has a similar effect of allocateNew() without actually clearing and reallocating the value vector. The purpose is to move the value vector to a "mutate" state
    • exchange

      public void exchange(ValueVector other)
      Description copied from interface: ValueVector
      Exchange state with another value vector of the same type. Used to implement look-ahead writers.
    • collectLedgers

      public void collectLedgers(Set<AllocationManager.BufferLedger> ledgers)
      Description copied from interface: ValueVector
      Add the ledgers underlying the buffers underlying the components of the vector to the set provided. Used to determine actual memory allocation.
      Parameters:
      ledgers - set of ledgers to which to add ledgers for this vector