java.lang.Object
org.apache.arrow.vector.BaseValueVector
org.apache.arrow.vector.ExtensionTypeVector<StructVector>
org.apache.arrow.variant.extension.VariantVector
- All Implemented Interfaces:
Closeable,AutoCloseable,Iterable<ValueVector>,FieldVector,ValueVector
Arrow vector for storing
VariantType values.
Stores semi-structured data (like JSON) as metadata + value binary pairs, allowing type-flexible columnar storage within Arrow's type system.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static classVariantTransferPair is a transfer pair for VariantVector. -
Field Summary
FieldsFields inherited from class org.apache.arrow.vector.BaseValueVector
allocator, fieldReader, INITIAL_VALUE_ALLOCATION, MAX_ALLOCATION_SIZE, MAX_ALLOCATION_SIZE_PROPERTY, validityBuffer, valueCount -
Constructor Summary
ConstructorsConstructorDescriptionVariantVector(String name, BufferAllocator allocator) Constructs a new VariantVector with the given name and allocator. -
Method Summary
Modifier and TypeMethodDescriptionvoidcopyFrom(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.Creates the child fields for the VariantVector.static FieldcreateVariantField(String name) Creates a new VariantVector with the given name.voidget(int index, NullableVariantHolder holder) Retrieves the variant value at the specified index into the provided holder.voidget(int index, VariantHolder holder) Retrieves the variant value at the specified index into the provided non-nullable holder.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.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.voidinitializeChildrenFromFields(List<Field> children) Initializes the child vectors to be later loaded with loadBuffers.makeTransferPair(ValueVector target) Makes a new transfer pair used to transfer underlying buffers.voidset(int index, NullableVariantHolder holder) Sets the variant value at the specified index from the provided nullable holder.voidset(int index, VariantHolder holder) Sets the variant value at the specified index from the provided holder.voidsetSafe(int index, NullableVariantHolder holder) Sets the variant value at the specified index from the provided nullable holder, with bounds checking.voidsetSafe(int index, VariantHolder holder) Sets the variant value at the specified index from the provided holder, with bounds checking.voidSets the value at the given index from the provided Variant.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, isNull, iterator, loadFieldBuffers, reAlloc, reset, setInitialCapacity, setNull, setValueCountMethods inherited from class org.apache.arrow.vector.BaseValueVector
allocateValidityBuffer, checkBufRefs, 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, spliteratorMethods inherited from interface org.apache.arrow.vector.ValueVector
getReader, validate, validateFull
-
Field Details
-
METADATA_VECTOR_NAME
- See Also:
-
VALUE_VECTOR_NAME
- See Also:
-
-
Constructor Details
-
VariantVector
Constructs a new VariantVector with the given name and allocator.- Parameters:
name- the name of the vectorallocator- the buffer allocator for memory management
-
-
Method Details
-
createVariantField
Creates a new VariantVector with the given name. The Variant Field schema has to be the same everywhere, otherwise ArrowBuffer loading might fail during serialization/deserialization and schema mismatches can occur. This includes CompleteType's VARIANT and VARIANT_REQUIRED types. -
createVariantChildFields
Creates the child fields for the VariantVector. Metadata vector will be index 0 and value vector will be index 1. -
initializeChildrenFromFields
Description copied from interface:FieldVectorInitializes the child vectors to be later loaded with loadBuffers.- Specified by:
initializeChildrenFromFieldsin interfaceFieldVector- Overrides:
initializeChildrenFromFieldsin classExtensionTypeVector<StructVector>- Parameters:
children- the schema
-
getField
Description copied from interface:ValueVectorGet information about how this field is materialized.- Specified by:
getFieldin interfaceValueVector- Overrides:
getFieldin classExtensionTypeVector<StructVector>- Returns:
- the field corresponding to this vector
-
getMetadataVector
-
getValueVector
-
makeTransferPair
Description copied from interface:ValueVectorMakes a new transfer pair used to transfer underlying buffers.- Specified by:
makeTransferPairin interfaceValueVector- Overrides:
makeTransferPairin classExtensionTypeVector<StructVector>- Parameters:
target- the target for the transfer- Returns:
- a new
transfer pairthat is used to transfer underlying buffers into the target vector.
-
getTransferPair
Description copied from interface:ValueVectorTo transfer quota responsibility.- Specified by:
getTransferPairin interfaceValueVector- Overrides:
getTransferPairin classExtensionTypeVector<StructVector>- 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<StructVector>- 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<StructVector>- 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<StructVector>- 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<StructVector>- Parameters:
allocator- the target allocator- Returns:
- a
transfer pair, creating a new target vector of the same type.
-
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
-
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<StructVector>- Parameters:
index- index of object to get- Returns:
- friendly type object, null if value is unset
-
get
Retrieves the variant value at the specified index into the provided holder.- Parameters:
index- the index of the value to retrieveholder- the holder to populate with the variant data
-
get
Retrieves the variant value at the specified index into the provided non-nullable holder.- Parameters:
index- the index of the value to retrieveholder- the holder to populate with the variant data
-
set
Sets the variant value at the specified index from the provided holder.- Parameters:
index- the index at which to set the valueholder- the holder containing the variant data to set
-
set
Sets the variant value at the specified index from the provided nullable holder.- Parameters:
index- the index at which to set the valueholder- the nullable holder containing the variant data to set
-
setSafe
Sets the variant value at the specified index from the provided holder, with bounds checking.- Parameters:
index- the index at which to set the valueholder- the holder containing the variant data to set
-
setSafe
Sets the variant value at the specified index from the provided nullable holder, with bounds checking.- Parameters:
index- the index at which to set the valueholder- the nullable holder containing the variant data to set
-
setSafe
Sets the value at the given index from the provided Variant. -
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<StructVector>- Returns:
- Returns a lambda that initializes a reader when called.
-
hashCode
public int hashCode(int index) Description copied from interface:ValueVectorReturns hashCode of element in index with the default hasher. -
hashCode
Description copied from interface:ValueVectorReturns hashCode of element in index with the given hasher.
-