Class UInt2Vector

All Implemented Interfaces:
Closeable, AutoCloseable, Iterable<ValueVector>, BaseIntVector, ElementAddressableVector, FieldVector, FixedWidthVector, ValueIterableVector<Character>, ValueVector, VectorDefinitionSetter

public final class UInt2Vector extends BaseFixedWidthVector implements BaseIntVector, ValueIterableVector<Character>
UInt2Vector implements a fixed width (2 bytes) vector of integer values which could be null. A validity buffer (bit vector) is maintained to track which elements in the vector are null.
  • Field Details

  • Constructor Details

  • 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()
      Specified by:
      getMinorType in interface ValueVector
    • get

      public static char get(ArrowBuf buffer, int index)
      Given a data buffer, get the value stored at a particular position in the vector.

      This method is mainly meant for integration tests.

      Parameters:
      buffer - data buffer
      index - position of the element.
      Returns:
      value stored at the index.
    • get

      public char get(int index) throws IllegalStateException
      Get the element at the given index from the vector.
      Parameters:
      index - position of element
      Returns:
      element at given index
      Throws:
      IllegalStateException
    • get

      public void get(int index, NullableUInt2Holder holder)
      Get the element at the given index from the vector and sets the state in holder. If element at given index is null, holder.isSet will be zero.
      Parameters:
      index - position of element
    • getObject

      public Character getObject(int index)
      Same as get(int).
      Specified by:
      getObject in interface ValueVector
      Parameters:
      index - position of element
      Returns:
      element at given index
    • set

      public void set(int index, int value)
      Set the element at the given index to the given value.
      Parameters:
      index - position of element
      value - value of element
    • set

      public void set(int index, char value)
      Set the element at the given index to the given value.
      Parameters:
      index - position of element
      value - value of element
    • set

      public void set(int index, NullableUInt2Holder holder) throws IllegalArgumentException
      Set the element at the given index to the value set in data holder. If the value in holder is not indicated as set, element in the at the given index will be null.
      Parameters:
      index - position of element
      holder - nullable data holder for value of element
      Throws:
      IllegalArgumentException
    • set

      public void set(int index, UInt2Holder holder)
      Set the element at the given index to the value set in data holder.
      Parameters:
      index - position of element
      holder - data holder for value of element
    • setSafe

      public void setSafe(int index, int value)
      Same as set(int, int) except that it handles the case when index is greater than or equal to existing value capacity BaseFixedWidthVector.getValueCapacity().
      Parameters:
      index - position of element
      value - value of element
    • setSafe

      public void setSafe(int index, char value)
      Same as set(int, char) except that it handles the case when index is greater than or equal to existing value capacity BaseFixedWidthVector.getValueCapacity().
      Parameters:
      index - position of element
      value - value of element
    • setSafe

      public void setSafe(int index, NullableUInt2Holder holder) throws IllegalArgumentException
      Same as set(int, NullableUInt2Holder) except that it handles the case when index is greater than or equal to existing value capacity BaseFixedWidthVector.getValueCapacity().
      Parameters:
      index - position of element
      holder - nullable data holder for value of element
      Throws:
      IllegalArgumentException
    • setSafe

      public void setSafe(int index, UInt2Holder holder)
      Same as set(int, UInt2Holder) except that it handles the case when index is greater than or equal to existing value capacity BaseFixedWidthVector.getValueCapacity().
      Parameters:
      index - position of element
      holder - data holder for value of element
    • set

      public void set(int index, int isSet, char value)
      Sets the given index to value is isSet is positive, otherwise sets the position as invalid/null.
    • setSafe

      public void setSafe(int index, int isSet, char value)
      Same as set(int, int, char) but will reallocate the buffer if index is larger than current capacity.
    • getTransferPair

      public TransferPair getTransferPair(String ref, BufferAllocator allocator)
      Description copied from class: BaseFixedWidthVector
      Construct a transfer pair of this vector and another vector of same type.
      Specified by:
      getTransferPair in interface ValueVector
      Specified by:
      getTransferPair in class BaseFixedWidthVector
      Parameters:
      ref - name of the target vector
      allocator - allocator for the target vector
      Returns:
      TransferPair
    • getTransferPair

      public TransferPair getTransferPair(Field field, 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 BaseFixedWidthVector
      Parameters:
      field - Field object used by the target vector
      allocator - allocator for the target vector
      Returns:
      TransferPair
    • makeTransferPair

      public TransferPair makeTransferPair(ValueVector to)
      Description copied from interface: ValueVector
      Makes a new transfer pair used to transfer underlying buffers.
      Specified by:
      makeTransferPair in interface ValueVector
      Parameters:
      to - the target for the transfer
      Returns:
      a new transfer pair that is used to transfer underlying buffers into the target vector.
    • setWithPossibleTruncate

      public void setWithPossibleTruncate(int index, long value)
      Description copied from interface: BaseIntVector
      Sets the value at index, note this value may need to be truncated. Note this is safe version (i.e. call setSafe(int, ...) method in vector)
      Specified by:
      setWithPossibleTruncate in interface BaseIntVector
    • setUnsafeWithPossibleTruncate

      public void setUnsafeWithPossibleTruncate(int index, long value)
      Description copied from interface: BaseIntVector
      Sets the value at index, note this value may need to be truncated. Note this is unsafe version (i.e. call set(int, ...) method in vector)
      Specified by:
      setUnsafeWithPossibleTruncate in interface BaseIntVector
    • getValueAsLong

      public long getValueAsLong(int index)
      Description copied from interface: BaseIntVector
      Gets the value at index. This value may have been extended to long and will throw NullPointerException if the value is null. Note null check could be turned off via NullCheckingForGet.
      Specified by:
      getValueAsLong in interface BaseIntVector
    • toString

      public String toString()
      Description copied from class: BaseValueVector
      Representation of vector suitable for debugging.
      Overrides:
      toString in class BaseValueVector