Class UInt8Vector

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

public final class UInt8Vector extends BaseFixedWidthVector implements BaseIntVector, ValueIterableVector<Long>
UInt8Vector implements a fixed width vector (8 bytes) 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
    • getNoOverflow

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

      To avoid overflow, the returned type is one step up from the signed type.

      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 long 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, NullableUInt8Holder 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 Long getObject(int index)
      Same as get(int).
      Specified by:
      getObject in interface ValueVector
      Parameters:
      index - position of element
      Returns:
      element at given index
    • getObjectNoOverflow

      public BigInteger getObjectNoOverflow(int index)
      Returns the value stored at index without the potential for overflow.
      Parameters:
      index - position of element
      Returns:
      element at given index
    • set

      public void set(int index, long 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, NullableUInt8Holder 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, UInt8Holder 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, long value)
      Same as set(int, long) 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, NullableUInt8Holder holder) throws IllegalArgumentException
      Same as set(int, NullableUInt8Holder) 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, UInt8Holder holder)
      Same as set(int, UInt8Holder) 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, long value)
      Sets value at index is isSet is positive otherwise sets the index to invalid/null.
    • setSafe

      public void setSafe(int index, int isSet, long value)
      Same as set(int, int, long) but will reallocate if index is greater 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