Class MapVector

All Implemented Interfaces:
Closeable, AutoCloseable, Iterable<ValueVector>, ValueVector
Direct Known Subclasses:
VectorAccessibleComplexWriter

public class MapVector extends AbstractMapVector
  • Field Details

  • Constructor Details

  • Method Details

    • getReader

      public FieldReader getReader()
      Description copied from interface: ValueVector
      Returns a field reader that supports reading values from this vector.
    • copyFromSafe

      public void copyFromSafe(int fromIndex, int thisIndex, MapVector from)
    • copyFromSafe

      public void copyFromSafe(int fromSubIndex, int thisIndex, RepeatedMapVector from)
    • copyEntry

      public void copyEntry(int toIndex, ValueVector from, int fromIndex)
    • supportsDirectRead

      protected boolean supportsDirectRead()
      Overrides:
      supportsDirectRead in class AbstractContainerVector
    • fieldNameIterator

      public Iterator<String> fieldNameIterator()
    • setInitialCapacity

      public void setInitialCapacity(int numRecords)
      Description copied from interface: ValueVector
      Set the initial record capacity
    • 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
      Overrides:
      getBufferSize in class AbstractMapVector
    • 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
      Overrides:
      getAllocatedSize in class AbstractMapVector
      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.
      Parameters:
      valueCount - the number of values to assume this vector contains
      Returns:
      the buffer size if this vector is holding valueCount values
    • 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
      Overrides:
      getBuffers in class AbstractMapVector
      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.
    • getTransferPair

      public TransferPair getTransferPair(BufferAllocator allocator)
      Description copied from interface: ValueVector
      Returns a transfer pair, creating a new target vector of the same type.
    • makeTransferPair

      public TransferPair makeTransferPair(ValueVector to)
      Description copied from interface: ValueVector
      Returns a new transfer pair that is used to transfer underlying buffers into the target vector.
    • getTransferPair

      public TransferPair getTransferPair(String ref, BufferAllocator allocator)
    • getValueCapacity

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

      public MapVector.Accessor getAccessor()
      Description copied from interface: ValueVector
      Returns an accessor that is used to read from this vector instance.
    • load

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

      public UserBitShared.SerializedField getMetadata()
      Description copied from interface: ValueVector
      Get the metadata for this field. Used in serialization
      Returns:
      FieldMetadata for this field.
    • getMutator

      public MapVector.Mutator getMutator()
      Description copied from interface: ValueVector
      Returns an mutator that is used to write to this vector instance.
    • getVectorById

      public ValueVector getVectorById(int id)
    • setMapValueCount

      public void setMapValueCount(int valueCount)
      Set the value count for the map without setting the counts for the contained vectors. Use this only when the values of the contained vectors are set elsewhere in the code.
      Parameters:
      valueCount - number of items in the map
    • clear

      public void clear()
      Description copied from interface: ValueVector
      Release the underlying DrillBuf and reset the ValueVector to empty.
    • close

      public void close()
      Description copied from class: AbstractContainerVector
      Clears out all underlying child vectors.
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Specified by:
      close in interface ValueVector
      Overrides:
      close in class AbstractMapVector
    • toNullable

      public void toNullable(ValueVector nullableVector)
      Description copied from interface: ValueVector
      Convert a non-nullable vector to nullable by shuffling the data from one to the other. Avoids the need to generate copy code just to change mode. If this vector is non-nullable, accepts a nullable dual (same minor type, different mode.) If the vector is non-nullable, or non-scalar, then throws an exception.
      Parameters:
      nullableVector - nullable vector of the same minor type as this vector
    • 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
      Overrides:
      exchange in class AbstractMapVector