Package org.apache.arrow.vector.complex
Class NonNullableStructVector
java.lang.Object
org.apache.arrow.vector.complex.AbstractContainerVector
org.apache.arrow.vector.complex.AbstractStructVector
org.apache.arrow.vector.complex.NonNullableStructVector
- All Implemented Interfaces:
Closeable,AutoCloseable,Iterable<ValueVector>,DensityAwareVector,ValueIterableVector<Map<String,,?>> ValueVector
- Direct Known Subclasses:
StructVector
public class NonNullableStructVector
extends AbstractStructVector
implements ValueIterableVector<Map<String,?>>
A struct vector that has no null values (and no validity buffer). Child Vectors are handled in
AbstractStructVector.-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class org.apache.arrow.vector.complex.AbstractStructVector
AbstractStructVector.ConflictPolicy -
Field Summary
FieldsFields inherited from class org.apache.arrow.vector.complex.AbstractStructVector
allowConflictPolicyChangesFields inherited from class org.apache.arrow.vector.complex.AbstractContainerVector
allocator, callBack, name -
Constructor Summary
ConstructorsConstructorDescriptionNonNullableStructVector(String name, BufferAllocator allocator, FieldType fieldType, CallBack callBack) Constructs a new instance.NonNullableStructVector(String name, BufferAllocator allocator, FieldType fieldType, CallBack callBack, AbstractStructVector.ConflictPolicy conflictPolicy, boolean allowConflictPolicyChanges) Constructs a new instance.NonNullableStructVector(Field field, BufferAllocator allocator, CallBack callBack) Constructs a new instance.NonNullableStructVector(Field field, BufferAllocator allocator, CallBack callBack, AbstractStructVector.ConflictPolicy conflictPolicy, boolean allowConflictPolicyChanges) Constructs a new instance. -
Method Summary
Modifier and TypeMethodDescription<OUT,IN> OUT accept(VectorVisitor<OUT, IN> visitor, IN value) Accept a genericVectorVisitorand return the result.voidclear()Release any owned ArrowBuf and reset the ValueVector to the initial state.voidclose()Clears out all underlying child vectors.voidcopyFrom(int fromIndex, int thisIndex, ValueVector from) Copies the element at fromIndex in the provided vector to thisIndex.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.static NonNullableStructVectorempty(String name, BufferAllocator allocator) Construct a new empty instance which replaces an existing field with the new one in case of name conflict.static NonNullableStructVectoremptyWithDuplicates(String name, BufferAllocator allocator) Construct a new empty instance which preserve fields with identical names.voidget(int index, ComplexHolder holder) intGet the number of bytes used by this vector.intgetBufferSizeFor(int valueCount) Returns the number of bytes that is used by this vector if it holds the given number of values.Gets the underlying buffer associated with data vector.getField()Get information about how this field is materialized.intReturns number of null elements in the vector.getObject(int index) Get friendly type object from the vector.Gets the underlying buffer associated with offset vector.Get a reader for this vector.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.Gets the underlying buffer associated with validity vector.intReturns the maximum number of values that can be stored in this vector instance.intGets the number of values.getVectorById(int id) <V extends ValueVector>
VgetVectorById(int id, Class<V> clazz) Gets a child vector by ordinal position and casts to the specified class.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 struct's members from the given Fields.booleanisNull(int index) Check whether an element in the vector is null.Makes a new transfer pair used to transfer underlying buffers.voidreset()Reset the ValueVector to the initial state without releasing any owned ArrowBuf.voidsetInitialCapacity(int numRecords) Set the initial record capacity.voidsetInitialCapacity(int valueCount, double density) Set value with density.voidsetValueCount(int valueCount) Set number of values in the vector.protected booleanMethods inherited from class org.apache.arrow.vector.complex.AbstractStructVector
add, addOrGet, allocateNewSafe, getBuffers, getChild, getChildByOrdinal, getChildFieldNames, getChildren, getChildVectorWithOrdinal, getConflictPolicy, getPrimitiveVectors, iterator, putChild, putVector, reAlloc, setConflictPolicy, size, toStringMethods inherited from class org.apache.arrow.vector.complex.AbstractContainerVector
addOrGetFixedSizeList, addOrGetList, addOrGetMap, addOrGetStruct, addOrGetUnion, allocateNew, getAllocator, getChild, getName, typeifyMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods 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
allocateNew, allocateNewSafe, getAllocator, getBuffers, getName, reAlloc, validate, validateFull
-
Field Details
-
field
-
valueCount
public int valueCount
-
-
Constructor Details
-
NonNullableStructVector
public NonNullableStructVector(String name, BufferAllocator allocator, FieldType fieldType, CallBack callBack) Constructs a new instance.- Parameters:
name- The name of the instance.allocator- The allocator to use to allocating/reallocating buffers.fieldType- The type of this list.
-
NonNullableStructVector
Constructs a new instance.- Parameters:
field- The field materialized by this vector.allocator- The allocator to use to allocating/reallocating buffers.callBack- A schema change callback.
-
NonNullableStructVector
public NonNullableStructVector(String name, BufferAllocator allocator, FieldType fieldType, CallBack callBack, AbstractStructVector.ConflictPolicy conflictPolicy, boolean allowConflictPolicyChanges) Constructs a new instance.- Parameters:
name- The name of the instance.allocator- The allocator to use to allocating/reallocating buffers.fieldType- The type of this list.callBack- A schema change callback.conflictPolicy- How to handle duplicate field names in the struct.
-
NonNullableStructVector
public NonNullableStructVector(Field field, BufferAllocator allocator, CallBack callBack, AbstractStructVector.ConflictPolicy conflictPolicy, boolean allowConflictPolicyChanges) Constructs a new instance.- Parameters:
field- The field materialized by this vector.allocator- The allocator to use to allocating/reallocating buffers.callBack- A schema change callback.conflictPolicy- How to handle duplicate field names in the struct.
-
-
Method Details
-
empty
Construct a new empty instance which replaces an existing field with the new one in case of name conflict. -
emptyWithDuplicates
Construct a new empty instance which preserve fields with identical names. -
getReader
Description copied from interface:ValueVectorGet a reader for this vector.- Specified by:
getReaderin interfaceValueVector- Returns:
- a
field readerthat supports reading values from this vector.
-
copyFrom
Copies the element at fromIndex in the provided vector to thisIndex. Reallocates buffers if thisIndex is larger then current capacity.- Specified by:
copyFromin interfaceValueVector- Overrides:
copyFromin classAbstractContainerVector- 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 classAbstractContainerVector- Parameters:
fromIndex- position to copy from in source vectorthisIndex- position to copy to in this vectorfrom- source vector
-
supportsDirectRead
protected boolean supportsDirectRead()- Overrides:
supportsDirectReadin classAbstractContainerVector
-
fieldNameIterator
-
setInitialCapacity
public void setInitialCapacity(int numRecords) Description copied from interface:ValueVectorSet the initial record capacity.- Specified by:
setInitialCapacityin interfaceValueVector- Parameters:
numRecords- the initial record capacity.
-
setInitialCapacity
public void setInitialCapacity(int valueCount, double density) Description copied from interface:DensityAwareVectorSet value with density.- Specified by:
setInitialCapacityin interfaceDensityAwareVector- Parameters:
valueCount- the number of values in this vectordensity- the density of the vector
-
getBufferSize
public int getBufferSize()Description copied from interface:ValueVectorGet the number of bytes used by this vector.- Specified by:
getBufferSizein interfaceValueVector- Overrides:
getBufferSizein classAbstractStructVector- Returns:
- the number of bytes that is used by this vector instance.
-
getBufferSizeFor
public int getBufferSizeFor(int valueCount) Description copied from interface:ValueVectorReturns the number of bytes that is used by this vector if it holds the given number of values. The result will be the same as if setValueCount() were called, followed by calling getBufferSize(), but without any of the closing side-effects that setValueCount() implies wrt finishing off the population of a vector. Some operations might wish to use this to determine how much memory has been used by a vector so far, even though it is not finished being populated.- Specified by:
getBufferSizeForin interfaceValueVector- Parameters:
valueCount- the number of values to assume this vector contains- Returns:
- the buffer size if this vector is holding valueCount values
-
getValidityBuffer
Description copied from interface:ValueVectorGets the underlying buffer associated with validity vector.- Specified by:
getValidityBufferin interfaceValueVector- Returns:
- buffer
-
getDataBuffer
Description copied from interface:ValueVectorGets the underlying buffer associated with data vector.- Specified by:
getDataBufferin interfaceValueVector- Returns:
- buffer
-
getOffsetBuffer
Description copied from interface:ValueVectorGets the underlying buffer associated with offset vector.- Specified by:
getOffsetBufferin interfaceValueVector- Returns:
- buffer
-
getTransferPair
Description copied from interface:ValueVectorTo transfer quota responsibility.- Specified by:
getTransferPairin interfaceValueVector- Parameters:
allocator- 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- 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.
-
makeTransferPair
Description copied from interface:ValueVectorMakes a new transfer pair used to transfer underlying buffers.- Specified by:
makeTransferPairin interfaceValueVector- Parameters:
to- 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- 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- 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- 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.
-
getValueCapacity
public int getValueCapacity()Description copied from interface:ValueVectorReturns the maximum number of values that can be stored in this vector instance.- Specified by:
getValueCapacityin interfaceValueVector- Returns:
- the maximum number of values that can be stored in this vector instance.
-
getObject
Description copied from interface:ValueVectorGet friendly type object from the vector.- Specified by:
getObjectin interfaceValueVector- Parameters:
index- index of object to get- Returns:
- friendly type object
-
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
-
accept
Description copied from interface:ValueVectorAccept a genericVectorVisitorand return the result.- Specified by:
acceptin interfaceValueVector- Type Parameters:
OUT- the output result type.IN- the input data together with visitor.
-
isNull
public boolean isNull(int index) Description copied from interface:ValueVectorCheck whether an element in the vector is null.- Specified by:
isNullin interfaceValueVector- Parameters:
index- index to check for null- Returns:
- true if element is null
-
getNullCount
public int getNullCount()Description copied from interface:ValueVectorReturns number of null elements in the vector.- Specified by:
getNullCountin interfaceValueVector- Returns:
- number of null elements
-
get
-
getValueCount
public int getValueCount()Description copied from interface:ValueVectorGets the number of values.- Specified by:
getValueCountin interfaceValueVector- Returns:
- number of values in the vector
-
getVectorById
-
getVectorById
Gets a child vector by ordinal position and casts to the specified class. -
setValueCount
public void setValueCount(int valueCount) Description copied from interface:ValueVectorSet number of values in the vector.- Specified by:
setValueCountin interfaceValueVector
-
clear
public void clear()Description copied from interface:ValueVectorRelease any owned ArrowBuf and reset the ValueVector to the initial state. If the vector has any child vectors, they will also be cleared.- Specified by:
clearin interfaceValueVector
-
reset
public void reset()Description copied from interface:ValueVectorReset the ValueVector to the initial state without releasing any owned ArrowBuf. Buffer capacities will remain unchanged and any previous data will be zeroed out. This includes buffers for data, validity, offset, etc. If the vector has any child vectors, they will also be reset.- Specified by:
resetin interfaceValueVector
-
getField
Description copied from interface:ValueVectorGet information about how this field is materialized.- Specified by:
getFieldin interfaceValueVector- Returns:
- the field corresponding to this vector
-
getMinorType
- Specified by:
getMinorTypein interfaceValueVector
-
close
public void close()Description copied from class:AbstractContainerVectorClears out all underlying child vectors.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceValueVector- Overrides:
closein classAbstractStructVector
-
initializeChildrenFromFields
Initializes the struct's members from the given Fields. -
getChildrenFromFields
-