Class UuidVector

All Implemented Interfaces:
Closeable, AutoCloseable, Iterable<ValueVector>, ElementAddressableVector, FieldVector, FixedWidthVector, ValueIterableVector<UUID>, ValueVector

Vector implementation for UUID values using UuidType.

Supports setting and retrieving UUIDs with efficient storage and nullable value handling.

Usage:


 UuidVector vector = new UuidVector("uuid_col", allocator);
 vector.set(0, UUID.randomUUID());
 UUID value = vector.getObject(0);
 
See Also:
  • Field Details

    • TYPE_WIDTH

      public static final int TYPE_WIDTH
      The fixed byte width of UUID values (16 bytes).
      See Also:
  • Constructor Details

    • UuidVector

      public UuidVector(String name, BufferAllocator allocator, FixedSizeBinaryVector underlyingVector)
      Constructs a UUID vector with the given name, allocator, and underlying vector.
      Parameters:
      name - the name of the vector
      allocator - the buffer allocator
      underlyingVector - the underlying FixedSizeBinaryVector for storage
    • UuidVector

      public UuidVector(String name, FieldType fieldType, BufferAllocator allocator, FixedSizeBinaryVector underlyingVector)
      Constructs a UUID vector with the given name, field type, allocator, and underlying vector.
      Parameters:
      name - the name of the vector
      fieldType - the field type (should contain UuidType)
      allocator - the buffer allocator
      underlyingVector - the underlying FixedSizeBinaryVector for storage
    • UuidVector

      public UuidVector(String name, BufferAllocator allocator)
      Constructs a UUID vector with the given name and allocator.

      Creates a new underlying FixedSizeBinaryVector with 16-byte width.

      Parameters:
      name - the name of the vector
      allocator - the buffer allocator
    • UuidVector

      public UuidVector(Field field, BufferAllocator allocator)
      Constructs a UUID vector from a field and allocator.
      Parameters:
      field - the field definition (should contain UuidType)
      allocator - the buffer allocator
  • Method Details

    • getObject

      public UUID getObject(int index)
      Description copied from class: ExtensionTypeVector
      Get the extension object at the specified index.

      Generally, this should access the underlying vector and construct the corresponding Java object from the raw data.

      Specified by:
      getObject in interface ValueVector
      Specified by:
      getObject in class ExtensionTypeVector<FixedSizeBinaryVector>
      Parameters:
      index - index of object to get
      Returns:
      friendly type object, null if value is unset
    • hashCode

      public int hashCode(int index)
      Description copied from interface: ValueVector
      Returns hashCode of element in index with the default hasher.
      Specified by:
      hashCode in interface ValueVector
    • hashCode

      public int hashCode(int index, ArrowBufHasher hasher)
      Description copied from interface: ValueVector
      Returns hashCode of element in index with the given hasher.
      Specified by:
      hashCode in interface ValueVector
    • isSet

      public int isSet(int index)
      Checks if the value at the given index is set (non-null).
      Parameters:
      index - the index to check
      Returns:
      1 if the value is set, 0 if null
    • get

      public ArrowBuf get(int index) throws IllegalStateException
      Gets the UUID value at the given index as an ArrowBuf.
      Parameters:
      index - the index to retrieve
      Returns:
      a buffer slice containing the 16-byte UUID
      Throws:
      IllegalStateException - if the value at the index is null and null checking is enabled
    • get

      public void get(int index, NullableUuidHolder holder)
      Reads the UUID value at the given index into a NullableUuidHolder.
      Parameters:
      index - the index to read from
      holder - the holder to populate with the UUID data
    • get

      public void get(int index, UuidHolder holder)
      Reads the UUID value at the given index into a UuidHolder.
      Parameters:
      index - the index to read from
      holder - the holder to populate with the UUID data
    • set

      public void set(int index, UUID value)
      Sets the UUID value at the given index.
      Parameters:
      index - the index to set
      value - the UUID value to set, or null to set a null value
    • set

      public void set(int index, UuidHolder holder)
      Sets the UUID value at the given index from a UuidHolder.
      Parameters:
      index - the index to set
      holder - the holder containing the UUID data
    • set

      public void set(int index, NullableUuidHolder holder)
      Sets the UUID value at the given index from a NullableUuidHolder.
      Parameters:
      index - the index to set
      holder - the holder containing the UUID data
    • set

      public void set(int index, int isSet, ArrowBuf buffer)
      Sets the UUID value at the given index with explicit null flag.
      Parameters:
      index - the index to set
      isSet - 1 if the value is set, 0 if null
      buffer - the buffer containing the 16-byte UUID data
    • set

      public void set(int index, ArrowBuf value)
      Sets the UUID value at the given index from an ArrowBuf.
      Parameters:
      index - the index to set
      value - the buffer containing the 16-byte UUID data
    • set

      public void set(int index, ArrowBuf source, int sourceOffset)
      Sets the UUID value at the given index by copying from a source buffer.
      Parameters:
      index - the index to set
      source - the source buffer to copy from
      sourceOffset - the offset in the source buffer where the UUID data starts
    • set

      public void set(int index, byte[] value)
      Sets the UUID value at the given index from a byte array.
      Parameters:
      index - the index to set
      value - the 16-byte array containing the UUID data
    • setSafe

      public void setSafe(int index, UUID value)
      Sets the UUID value at the given index, expanding capacity if needed.
      Parameters:
      index - the index to set
      value - the UUID value to set, or null to set a null value
    • setSafe

      public void setSafe(int index, NullableUuidHolder holder)
      Sets the UUID value at the given index from a NullableUuidHolder, expanding capacity if needed.
      Parameters:
      index - the index to set
      holder - the holder containing the UUID data, or null to set a null value
    • setSafe

      public void setSafe(int index, UuidHolder holder)
      Sets the UUID value at the given index from a UuidHolder, expanding capacity if needed.
      Parameters:
      index - the index to set
      holder - the holder containing the UUID data, or null to set a null value
    • setSafe

      public void setSafe(int index, byte[] value)
      Sets the UUID value at the given index from a byte array, expanding capacity if needed.
      Parameters:
      index - the index to set
      value - the 16-byte array containing the UUID data
    • setSafe

      public void setSafe(int index, ArrowBuf value)
      Sets the UUID value at the given index from an ArrowBuf, expanding capacity if needed.
      Parameters:
      index - the index to set
      value - the buffer containing the 16-byte UUID data
    • copyFrom

      public void copyFrom(int fromIndex, int thisIndex, ValueVector from)
      Description copied from interface: ValueVector
      Copy a cell value from a particular index in source vector to a particular position in this vector.
      Specified by:
      copyFrom in interface ValueVector
      Overrides:
      copyFrom in class BaseValueVector
      Parameters:
      fromIndex - position to copy from in source vector
      thisIndex - position to copy to in this vector
      from - source vector
    • copyFromSafe

      public void copyFromSafe(int fromIndex, int thisIndex, ValueVector from)
      Description copied from interface: ValueVector
      Same as ValueVector.copyFrom(int, int, ValueVector) except that it handles the case when the capacity of the vector needs to be expanded before copy.
      Specified by:
      copyFromSafe in interface ValueVector
      Overrides:
      copyFromSafe in class BaseValueVector
      Parameters:
      fromIndex - position to copy from in source vector
      thisIndex - position to copy to in this vector
      from - source vector
    • getField

      public Field getField()
      Description copied from interface: ValueVector
      Get information about how this field is materialized.
      Specified by:
      getField in interface ValueVector
      Overrides:
      getField in class ExtensionTypeVector<FixedSizeBinaryVector>
      Returns:
      the field corresponding to this vector
    • getDataPointer

      public ArrowBufPointer getDataPointer(int i)
      Description copied from interface: ElementAddressableVector
      Gets the pointer for the data at the given index.
      Specified by:
      getDataPointer in interface ElementAddressableVector
      Parameters:
      i - the index for the data.
      Returns:
      the pointer to the data.
    • getDataPointer

      public ArrowBufPointer getDataPointer(int i, ArrowBufPointer arrowBufPointer)
      Description copied from interface: ElementAddressableVector
      Gets the pointer for the data at the given index.
      Specified by:
      getDataPointer in interface ElementAddressableVector
      Parameters:
      i - the index for the data.
      arrowBufPointer - the data pointer to fill, this avoids creating a new pointer object.
      Returns:
      the pointer to the data, it should be the same one as the input parameter
    • allocateNew

      public void allocateNew(int valueCount)
      Description copied from interface: FixedWidthVector
      Allocate a new memory space for this vector. Must be called prior to using the ValueVector.
      Specified by:
      allocateNew in interface FixedWidthVector
      Parameters:
      valueCount - Number of values in the vector.
    • zeroVector

      public void zeroVector()
      Description copied from interface: FixedWidthVector
      Zero out the underlying buffer backing this vector.
      Specified by:
      zeroVector in interface FixedWidthVector
    • 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
      Overrides:
      makeTransferPair in class ExtensionTypeVector<FixedSizeBinaryVector>
      Parameters:
      to - the target for the transfer
      Returns:
      a new transfer pair that is used to transfer underlying buffers into the target vector.
    • 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.
      Overrides:
      getReaderImpl in class ExtensionTypeVector<FixedSizeBinaryVector>
      Returns:
      Returns a lambda that initializes a reader when called.
    • getTransferPair

      public TransferPair getTransferPair(Field field, BufferAllocator allocator)
      Description copied from interface: ValueVector
      To transfer quota responsibility.
      Specified by:
      getTransferPair in interface ValueVector
      Overrides:
      getTransferPair in class ExtensionTypeVector<FixedSizeBinaryVector>
      Parameters:
      field - the Field object used by the target vector
      allocator - the target allocator
      Returns:
      a transfer pair, creating a new target vector of the same type.
    • getTransferPair

      public TransferPair getTransferPair(Field field, BufferAllocator allocator, CallBack callBack)
      Description copied from interface: ValueVector
      To transfer quota responsibility.
      Specified by:
      getTransferPair in interface ValueVector
      Overrides:
      getTransferPair in class ExtensionTypeVector<FixedSizeBinaryVector>
      Parameters:
      field - the Field object used by the target vector
      allocator - the target allocator
      callBack - A schema change callback.
      Returns:
      a transfer pair, creating a new target vector of the same type.
    • getTransferPair

      public TransferPair getTransferPair(String ref, BufferAllocator allocator)
      Description copied from interface: ValueVector
      To transfer quota responsibility.
      Specified by:
      getTransferPair in interface ValueVector
      Overrides:
      getTransferPair in class ExtensionTypeVector<FixedSizeBinaryVector>
      Parameters:
      ref - the name of the vector
      allocator - the target allocator
      Returns:
      a transfer pair, creating a new target vector of the same type.
    • getTransferPair

      public TransferPair getTransferPair(String ref, BufferAllocator allocator, CallBack callBack)
      Description copied from interface: ValueVector
      To transfer quota responsibility.
      Specified by:
      getTransferPair in interface ValueVector
      Overrides:
      getTransferPair in class ExtensionTypeVector<FixedSizeBinaryVector>
      Parameters:
      ref - the name of the vector
      allocator - the target allocator
      callBack - A schema change callback.
      Returns:
      a transfer pair, creating a new target vector of the same type.
    • getTransferPair

      public TransferPair getTransferPair(BufferAllocator allocator)
      Description copied from interface: ValueVector
      To transfer quota responsibility.
      Specified by:
      getTransferPair in interface ValueVector
      Overrides:
      getTransferPair in class ExtensionTypeVector<FixedSizeBinaryVector>
      Parameters:
      allocator - the target allocator
      Returns:
      a transfer pair, creating a new target vector of the same type.
    • getTypeWidth

      public int getTypeWidth()
      Description copied from interface: FixedWidthVector
      Get the width of the type in bytes.
      Specified by:
      getTypeWidth in interface FixedWidthVector