Class BaseRepeatedValueVector

java.lang.Object
org.apache.drill.exec.vector.BaseValueVector
org.apache.drill.exec.vector.complex.BaseRepeatedValueVector
All Implemented Interfaces:
Closeable, AutoCloseable, Iterable<ValueVector>, ContainerVectorLike, RepeatedValueVector, ValueVector
Direct Known Subclasses:
ListVector, RepeatedBigIntVector, RepeatedBitVector, RepeatedDateVector, RepeatedDecimal18Vector, RepeatedDecimal28DenseVector, RepeatedDecimal28SparseVector, RepeatedDecimal38DenseVector, RepeatedDecimal38SparseVector, RepeatedDecimal9Vector, RepeatedDictVector, RepeatedFloat4Vector, RepeatedFloat8Vector, RepeatedIntervalDayVector, RepeatedIntervalVector, RepeatedIntervalYearVector, RepeatedIntVector, RepeatedListVector.DelegateRepeatedVector, RepeatedSmallIntVector, RepeatedTimeStampVector, RepeatedTimeVector, RepeatedTinyIntVector, RepeatedUInt1Vector, RepeatedUInt2Vector, RepeatedUInt4Vector, RepeatedUInt8Vector, RepeatedVar16CharVector, RepeatedVarBinaryVector, RepeatedVarCharVector, RepeatedVarDecimalVector

public abstract class BaseRepeatedValueVector extends BaseValueVector implements RepeatedValueVector
  • Field Details

  • Constructor Details

  • Method Details

    • allocateNewSafe

      public boolean allocateNewSafe()
      Description copied from interface: ValueVector
      Allocates new buffers. ValueVector implements logic to determine how much to allocate.
      Specified by:
      allocateNewSafe in interface ValueVector
      Returns:
      Returns true if allocation was successful.
    • getOffsetVector

      public UInt4Vector getOffsetVector()
      Specified by:
      getOffsetVector in interface RepeatedValueVector
      Returns:
      the underlying offset vector or null if none exists.
    • getDataVector

      public ValueVector getDataVector()
      Specified by:
      getDataVector in interface RepeatedValueVector
      Returns:
      the underlying data vector or null if none exists.
    • setInitialCapacity

      public void setInitialCapacity(int numRecords)
      Description copied from interface: ValueVector
      Set the initial record capacity
      Specified by:
      setInitialCapacity in interface ValueVector
    • getValueCapacity

      public int getValueCapacity()
      Description copied from interface: ValueVector
      Returns the maximum number of values that can be stored in this vector instance.
      Specified by:
      getValueCapacity in interface ValueVector
    • getMetadataBuilder

      protected UserBitShared.SerializedField.Builder getMetadataBuilder()
      Overrides:
      getMetadataBuilder in class BaseValueVector
    • 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.
      Specified by:
      getBufferSize in interface ValueVector
    • 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.
      Specified by:
      getAllocatedSize in interface ValueVector
      Returns:
      allocated buffer size, in bytes
    • getBufferSizeFor

      public int getBufferSizeFor(int valueCount)
      Description copied from interface: ValueVector
      Returns the number of bytes that is used by this vector if it holds the given number of values. The result will be the same as if Mutator.setValueCount() were called, followed by calling getBufferSize(), but without any of the closing side-effects that setValueCount() implies wrt finishing off the population of a vector. Some operations might wish to use this to determine how much memory has been used by a vector so far, even though it is not finished being populated.
      Specified by:
      getBufferSizeFor in interface ValueVector
      Parameters:
      valueCount - the number of values to assume this vector contains
      Returns:
      the buffer size if this vector is holding valueCount values
    • iterator

      public Iterator<ValueVector> iterator()
      Specified by:
      iterator in interface Iterable<ValueVector>
      Overrides:
      iterator in class BaseValueVector
    • 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
    • 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).
      Specified by:
      getBuffers in interface ValueVector
      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.
    • load

      public void load(UserBitShared.SerializedField metadata, DrillBuf buffer)
      Description copied from interface: ValueVector
      Load the data provided in the buffer. Typically used when deserializing from the wire.
      Specified by:
      load in interface ValueVector
      Parameters:
      metadata - Metadata used to decode the incoming buffer.
      buffer - The buffer that contains the ValueVector.
    • size

      public int size()
      Returns 1 if inner vector is explicitly set via #addOrGetVector else 0
      Specified by:
      size in interface ContainerVectorLike
      See Also:
    • addOrGetVector

      public <T extends ValueVector> AddOrGetResult<T> addOrGetVector(VectorDescriptor descriptor)
      Description copied from interface: ContainerVectorLike
      Creates and adds a child vector if none with the same name exists, else returns the vector instance.
      Specified by:
      addOrGetVector in interface ContainerVectorLike
      Parameters:
      descriptor - vector descriptor
      Returns:
      result of operation wrapping vector corresponding to the given descriptor and whether it's newly created
    • replaceDataVector

      protected void replaceDataVector(ValueVector v)
    • setChildVector

      public void setChildVector(ValueVector childVector)
    • 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.
      Specified by:
      collectLedgers in interface ValueVector
      Parameters:
      ledgers - set of ledgers to which to add ledgers for this vector
    • getPayloadByteCount

      public int getPayloadByteCount(int valueCount)
      Description copied from interface: ValueVector
      Return the number of value bytes consumed by actual data.
      Specified by:
      getPayloadByteCount in interface ValueVector
    • 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.
      Specified by:
      exchange in interface ValueVector