Class ViewVarCharVector

All Implemented Interfaces:
Closeable, AutoCloseable, Iterable<ValueVector>, DensityAwareVector, ElementAddressableVector, FieldVector, ValueIterableVector<Text>, ValueVector, VariableWidthFieldVector, VariableWidthVector, VectorDefinitionSetter

public final class ViewVarCharVector extends BaseVariableWidthViewVector implements ValueIterableVector<Text>
ViewVarCharVector implements a view of a variable width vector of VARCHAR values which could be NULL. A validity buffer (bit vector) is maintained to track which elements in the vector are null. A viewBuffer keeps track of all values in the vector, and an external data buffer is kept to keep longer strings (>12).
  • Constructor Details

    • ViewVarCharVector

      public ViewVarCharVector(String name, BufferAllocator allocator)
      Instantiate a ViewVarCharVector. This doesn't allocate any memory for the data in vector.
      Parameters:
      name - name of the vector
      allocator - allocator for memory management.
    • ViewVarCharVector

      public ViewVarCharVector(String name, FieldType fieldType, BufferAllocator allocator)
      Instantiate a ViewVarCharVector. This doesn't allocate any memory for the data in vector.
      Parameters:
      name - name of the vector
      fieldType - type of Field materialized by this vector
      allocator - allocator for memory management.
    • ViewVarCharVector

      public ViewVarCharVector(Field field, BufferAllocator allocator)
      Instantiate a ViewVarCharVector. This doesn't allocate any memory for the data in vector.
      Parameters:
      field - field materialized by this vector
      allocator - allocator for memory management.
  • Method Details

    • getReaderImpl

      protected FieldReader getReaderImpl()
      Description copied from class: BaseValueVector
      Each vector has a different reader that implements the FieldReader interface. Overridden methods must make sure to return the correct concrete reader implementation.
      Specified by:
      getReaderImpl in class BaseValueVector
      Returns:
      Returns a lambda that initializes a reader when called.
    • getMinorType

      public Types.MinorType getMinorType()
      Get a minor type for this vector. The vector holds values belonging to a particular type.
      Specified by:
      getMinorType in interface ValueVector
      Returns:
      Types.MinorType
    • get

      public byte[] get(int index)
      Get the variable length element at specified index as a byte array.
      Specified by:
      get in interface VariableWidthFieldVector
      Parameters:
      index - position of an element to get
      Returns:
      array of bytes for a non-null element, null otherwise
    • getObject

      public Text getObject(int index)
      Get the variable length element at specified index as Text.
      Specified by:
      getObject in interface ValueVector
      Parameters:
      index - position of an element to get
      Returns:
      Text object for a non-null element, null otherwise
    • read

      public void read(int index, ReusableBuffer<?> buffer)
      Read the value at the given position to the given output buffer. The caller is responsible for checking for nullity first.
      Specified by:
      read in interface VariableWidthFieldVector
      Parameters:
      index - position of an element.
      buffer - the buffer to write into.
    • get

      public void get(int index, NullableViewVarCharHolder holder)
      Get the variable length element at specified index and sets the state in provided holder.
      Parameters:
      index - position of an element to get
      holder - data holder to be populated by this function
    • set

      public void set(int index, ViewVarCharHolder holder)
      Set the variable length element at the specified index to the data buffer supplied in the holder.
      Parameters:
      index - position of the element to set
      holder - holder that carries data buffer.
    • setSafe

      public void setSafe(int index, ViewVarCharHolder holder)
      Same as set(int, ViewVarCharHolder) except that it handles the case where index and length of a new element are beyond the existing capacity of the vector.
      Parameters:
      index - position of the element to set
      holder - holder that carries data buffer.
    • set

      public void set(int index, NullableViewVarCharHolder holder)
      Set the variable length element at the specified index to the data buffer supplied in the holder.
      Parameters:
      index - position of the element to set
      holder - holder that carries data buffer.
    • setSafe

      public void setSafe(int index, NullableViewVarCharHolder holder)
      Same as set(int, NullableViewVarCharHolder) except that it handles the case where index and length of a new element are beyond the existing capacity of the vector.
      Parameters:
      index - position of the element to set
      holder - holder that carries data buffer.
    • set

      public void set(int index, Text text)
      Set the variable length element at the specified index to the content in supplied Text.
      Parameters:
      index - position of the element to set
      text - Text object with data
    • setSafe

      public void setSafe(int index, Text text)
      Same as set(int, NullableViewVarCharHolder) except that it handles the case where index and length of a new element are beyond the existing capacity of the vector.
      Parameters:
      index - position of the element to set.
      text - Text object with data
    • validateScalars

      public void validateScalars()
      Description copied from class: BaseVariableWidthViewVector
      Validate the scalar values held by this vector.
      Overrides:
      validateScalars in class BaseVariableWidthViewVector
    • getTransferPair

      public TransferPair getTransferPair(String ref, BufferAllocator allocator)
      Construct a TransferPair comprising this and a target vector of the same type.
      Specified by:
      getTransferPair in interface ValueVector
      Specified by:
      getTransferPair in class BaseVariableWidthViewVector
      Parameters:
      ref - name of the target vector
      allocator - allocator for the target vector
      Returns:
      TransferPair (UnsupportedOperationException)
    • getTransferPair

      public TransferPair getTransferPair(Field field, BufferAllocator allocator)
      Construct a TransferPair with a desired target vector of the same type.
      Specified by:
      getTransferPair in interface ValueVector
      Specified by:
      getTransferPair in class BaseVariableWidthViewVector
      Parameters:
      field - The field materialized by this vector.
      allocator - allocator for the target vector
      Returns:
      TransferPair (UnsupportedOperationException)
    • makeTransferPair

      public TransferPair makeTransferPair(ValueVector to)
      Construct a TransferPair with a desired target vector of the same type.
      Specified by:
      makeTransferPair in interface ValueVector
      Parameters:
      to - the target for the transfer
      Returns:
      TransferPair (UnsupportedOperationException)