java.lang.Object
org.apache.arrow.vector.BaseValueVector
org.apache.arrow.vector.ExtensionTypeVector<FixedSizeBinaryVector>
org.apache.arrow.vector.UuidVector
- All Implemented Interfaces:
Closeable,AutoCloseable,Iterable<ValueVector>,ElementAddressableVector,FieldVector,FixedWidthVector,ValueIterableVector<UUID>,ValueVector
public class UuidVector
extends ExtensionTypeVector<FixedSizeBinaryVector>
implements ValueIterableVector<UUID>, FixedWidthVector
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:
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThe fixed byte width of UUID values (16 bytes).Fields inherited from class org.apache.arrow.vector.BaseValueVector
allocator, fieldReader, INITIAL_VALUE_ALLOCATION, MAX_ALLOCATION_SIZE, MAX_ALLOCATION_SIZE_PROPERTY, validityBuffer, valueCount -
Constructor Summary
ConstructorsConstructorDescriptionUuidVector(String name, BufferAllocator allocator) Constructs a UUID vector with the given name and allocator.UuidVector(String name, BufferAllocator allocator, FixedSizeBinaryVector underlyingVector) Constructs a UUID vector with the given name, allocator, and underlying vector.UuidVector(String name, FieldType fieldType, BufferAllocator allocator, FixedSizeBinaryVector underlyingVector) Constructs a UUID vector with the given name, field type, allocator, and underlying vector.UuidVector(Field field, BufferAllocator allocator) Constructs a UUID vector from a field and allocator. -
Method Summary
Modifier and TypeMethodDescriptionvoidallocateNew(int valueCount) Allocate a new memory space for this vector.voidcopyFrom(int fromIndex, int thisIndex, ValueVector from) Copy a cell value from a particular index in source vector to a particular position in this vector.voidcopyFromSafe(int fromIndex, int thisIndex, ValueVector from) Same asValueVector.copyFrom(int, int, ValueVector)except that it handles the case when the capacity of the vector needs to be expanded before copy.get(int index) Gets the UUID value at the given index as an ArrowBuf.voidget(int index, NullableUuidHolder holder) Reads the UUID value at the given index into a NullableUuidHolder.voidget(int index, UuidHolder holder) Reads the UUID value at the given index into a UuidHolder.getDataPointer(int i) Gets the pointer for the data at the given index.getDataPointer(int i, ArrowBufPointer arrowBufPointer) Gets the pointer for the data at the given index.getField()Get information about how this field is materialized.getObject(int index) Get the extension object at the specified index.protected FieldReaderEach vector has a different reader that implements the FieldReader interface.getTransferPair(String ref, BufferAllocator allocator) To transfer quota responsibility.getTransferPair(String ref, BufferAllocator allocator, CallBack callBack) To transfer quota responsibility.getTransferPair(BufferAllocator allocator) To transfer quota responsibility.getTransferPair(Field field, BufferAllocator allocator) To transfer quota responsibility.getTransferPair(Field field, BufferAllocator allocator, CallBack callBack) To transfer quota responsibility.intGet the width of the type in bytes.inthashCode(int index) Returns hashCode of element in index with the default hasher.inthashCode(int index, ArrowBufHasher hasher) Returns hashCode of element in index with the given hasher.intisSet(int index) Checks if the value at the given index is set (non-null).Makes a new transfer pair used to transfer underlying buffers.voidset(int index, byte[] value) Sets the UUID value at the given index from a byte array.voidSets the UUID value at the given index with explicit null flag.voidSets the UUID value at the given index.voidSets the UUID value at the given index from an ArrowBuf.voidSets the UUID value at the given index by copying from a source buffer.voidset(int index, NullableUuidHolder holder) Sets the UUID value at the given index from a NullableUuidHolder.voidset(int index, UuidHolder holder) Sets the UUID value at the given index from a UuidHolder.voidsetSafe(int index, byte[] value) Sets the UUID value at the given index from a byte array, expanding capacity if needed.voidSets the UUID value at the given index, expanding capacity if needed.voidSets the UUID value at the given index from an ArrowBuf, expanding capacity if needed.voidsetSafe(int index, NullableUuidHolder holder) Sets the UUID value at the given index from a NullableUuidHolder, expanding capacity if needed.voidsetSafe(int index, UuidHolder holder) Sets the UUID value at the given index from a UuidHolder, expanding capacity if needed.voidZero out the underlying buffer backing this vector.Methods inherited from class org.apache.arrow.vector.ExtensionTypeVector
accept, allocateNew, allocateNewSafe, clear, close, getAllocator, getBuffers, getBufferSize, getBufferSizeFor, getChildrenFromFields, getDataBuffer, getDataBufferAddress, getFieldBuffers, getFieldInnerVectors, getMinorType, getName, getNullCount, getOffsetBuffer, getOffsetBufferAddress, getUnderlyingVector, getValidityBuffer, getValidityBufferAddress, getValueCapacity, getValueCount, initializeChildrenFromFields, isNull, iterator, loadFieldBuffers, reAlloc, reset, setInitialCapacity, setNull, setValueCountMethods inherited from class org.apache.arrow.vector.BaseValueVector
allocateValidityBuffer, checkBufRefs, copyFrom, copyFromSafe, copyValidityBuffer, getReader, getValidityBufferSizeFromCount, releaseBuffer, sliceAndTransferValidityBuffer, splitAndTransferValidityBuffer, toString, transferBufferMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.arrow.vector.FieldVector
exportBuffer, exportCDataBuffers, getExportedCDataBufferCountMethods inherited from interface java.lang.Iterable
forEach, iterator, spliteratorMethods inherited from interface org.apache.arrow.vector.ValueIterableVector
getValueIterable, getValueIteratorMethods inherited from interface org.apache.arrow.vector.ValueVector
accept, allocateNew, allocateNewSafe, clear, close, copyFrom, copyFromSafe, getAllocator, getBuffers, getBufferSize, getBufferSizeFor, getDataBuffer, getMinorType, getName, getNullCount, getOffsetBuffer, getReader, getValidityBuffer, getValueCapacity, getValueCount, isNull, reAlloc, reset, setInitialCapacity, setValueCount, validate, validateFull
-
Field Details
-
TYPE_WIDTH
public static final int TYPE_WIDTHThe fixed byte width of UUID values (16 bytes).- See Also:
-
-
Constructor Details
-
UuidVector
Constructs a UUID vector with the given name, allocator, and underlying vector.- Parameters:
name- the name of the vectorallocator- the buffer allocatorunderlyingVector- 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 vectorfieldType- the field type (should contain UuidType)allocator- the buffer allocatorunderlyingVector- the underlying FixedSizeBinaryVector for storage
-
UuidVector
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 vectorallocator- the buffer allocator
-
UuidVector
Constructs a UUID vector from a field and allocator.- Parameters:
field- the field definition (should contain UuidType)allocator- the buffer allocator
-
-
Method Details
-
getObject
Description copied from class:ExtensionTypeVectorGet 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:
getObjectin interfaceValueVector- Specified by:
getObjectin classExtensionTypeVector<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:ValueVectorReturns hashCode of element in index with the default hasher.- Specified by:
hashCodein interfaceValueVector
-
hashCode
Description copied from interface:ValueVectorReturns hashCode of element in index with the given hasher.- Specified by:
hashCodein interfaceValueVector
-
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
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
Reads the UUID value at the given index into a NullableUuidHolder.- Parameters:
index- the index to read fromholder- the holder to populate with the UUID data
-
get
Reads the UUID value at the given index into a UuidHolder.- Parameters:
index- the index to read fromholder- the holder to populate with the UUID data
-
set
Sets the UUID value at the given index.- Parameters:
index- the index to setvalue- the UUID value to set, or null to set a null value
-
set
Sets the UUID value at the given index from a UuidHolder.- Parameters:
index- the index to setholder- the holder containing the UUID data
-
set
Sets the UUID value at the given index from a NullableUuidHolder.- Parameters:
index- the index to setholder- the holder containing the UUID data
-
set
Sets the UUID value at the given index with explicit null flag.- Parameters:
index- the index to setisSet- 1 if the value is set, 0 if nullbuffer- the buffer containing the 16-byte UUID data
-
set
Sets the UUID value at the given index from an ArrowBuf.- Parameters:
index- the index to setvalue- the buffer containing the 16-byte UUID data
-
set
Sets the UUID value at the given index by copying from a source buffer.- Parameters:
index- the index to setsource- the source buffer to copy fromsourceOffset- 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 setvalue- the 16-byte array containing the UUID data
-
setSafe
Sets the UUID value at the given index, expanding capacity if needed.- Parameters:
index- the index to setvalue- the UUID value to set, or null to set a null value
-
setSafe
Sets the UUID value at the given index from a NullableUuidHolder, expanding capacity if needed.- Parameters:
index- the index to setholder- the holder containing the UUID data, or null to set a null value
-
setSafe
Sets the UUID value at the given index from a UuidHolder, expanding capacity if needed.- Parameters:
index- the index to setholder- 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 setvalue- the 16-byte array containing the UUID data
-
setSafe
Sets the UUID value at the given index from an ArrowBuf, expanding capacity if needed.- Parameters:
index- the index to setvalue- the buffer containing the 16-byte UUID data
-
copyFrom
Description copied from interface:ValueVectorCopy a cell value from a particular index in source vector to a particular position in this vector.- Specified by:
copyFromin interfaceValueVector- Overrides:
copyFromin classBaseValueVector- Parameters:
fromIndex- position to copy from in source vectorthisIndex- position to copy to in this vectorfrom- source vector
-
copyFromSafe
Description copied from interface:ValueVectorSame asValueVector.copyFrom(int, int, ValueVector)except that it handles the case when the capacity of the vector needs to be expanded before copy.- Specified by:
copyFromSafein interfaceValueVector- Overrides:
copyFromSafein classBaseValueVector- Parameters:
fromIndex- position to copy from in source vectorthisIndex- position to copy to in this vectorfrom- source vector
-
getField
Description copied from interface:ValueVectorGet information about how this field is materialized.- Specified by:
getFieldin interfaceValueVector- Overrides:
getFieldin classExtensionTypeVector<FixedSizeBinaryVector>- Returns:
- the field corresponding to this vector
-
getDataPointer
Description copied from interface:ElementAddressableVectorGets the pointer for the data at the given index.- Specified by:
getDataPointerin interfaceElementAddressableVector- Parameters:
i- the index for the data.- Returns:
- the pointer to the data.
-
getDataPointer
Description copied from interface:ElementAddressableVectorGets the pointer for the data at the given index.- Specified by:
getDataPointerin interfaceElementAddressableVector- 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:FixedWidthVectorAllocate a new memory space for this vector. Must be called prior to using the ValueVector.- Specified by:
allocateNewin interfaceFixedWidthVector- Parameters:
valueCount- Number of values in the vector.
-
zeroVector
public void zeroVector()Description copied from interface:FixedWidthVectorZero out the underlying buffer backing this vector.- Specified by:
zeroVectorin interfaceFixedWidthVector
-
makeTransferPair
Description copied from interface:ValueVectorMakes a new transfer pair used to transfer underlying buffers.- Specified by:
makeTransferPairin interfaceValueVector- Overrides:
makeTransferPairin classExtensionTypeVector<FixedSizeBinaryVector>- Parameters:
to- the target for the transfer- Returns:
- a new
transfer pairthat is used to transfer underlying buffers into the target vector.
-
getReaderImpl
Description copied from class:BaseValueVectorEach vector has a different reader that implements the FieldReader interface. Overridden methods must make sure to return the correct concrete reader implementation.- Overrides:
getReaderImplin classExtensionTypeVector<FixedSizeBinaryVector>- Returns:
- Returns a lambda that initializes a reader when called.
-
getTransferPair
Description copied from interface:ValueVectorTo transfer quota responsibility.- Specified by:
getTransferPairin interfaceValueVector- Overrides:
getTransferPairin classExtensionTypeVector<FixedSizeBinaryVector>- Parameters:
field- the Field object used by the target vectorallocator- the target allocator- Returns:
- a
transfer pair, creating a new target vector of the same type.
-
getTransferPair
Description copied from interface:ValueVectorTo transfer quota responsibility.- Specified by:
getTransferPairin interfaceValueVector- Overrides:
getTransferPairin classExtensionTypeVector<FixedSizeBinaryVector>- Parameters:
field- the Field object used by the target vectorallocator- the target allocatorcallBack- A schema change callback.- Returns:
- a
transfer pair, creating a new target vector of the same type.
-
getTransferPair
Description copied from interface:ValueVectorTo transfer quota responsibility.- Specified by:
getTransferPairin interfaceValueVector- Overrides:
getTransferPairin classExtensionTypeVector<FixedSizeBinaryVector>- Parameters:
ref- the name of the vectorallocator- the target allocator- Returns:
- a
transfer pair, creating a new target vector of the same type.
-
getTransferPair
Description copied from interface:ValueVectorTo transfer quota responsibility.- Specified by:
getTransferPairin interfaceValueVector- Overrides:
getTransferPairin classExtensionTypeVector<FixedSizeBinaryVector>- Parameters:
ref- the name of the vectorallocator- the target allocatorcallBack- A schema change callback.- Returns:
- a
transfer pair, creating a new target vector of the same type.
-
getTransferPair
Description copied from interface:ValueVectorTo transfer quota responsibility.- Specified by:
getTransferPairin interfaceValueVector- Overrides:
getTransferPairin classExtensionTypeVector<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:FixedWidthVectorGet the width of the type in bytes.- Specified by:
getTypeWidthin interfaceFixedWidthVector
-