public abstract class BaseFixedWidthVector extends BaseValueVector implements FixedWidthVector, FieldVector, VectorDefinitionSetter
| Modifier and Type | Field and Description |
|---|---|
protected int |
actualValueCapacity |
protected Field |
field |
protected int |
lastValueCapacity |
protected ArrowBuf |
validityBuffer |
protected ArrowBuf |
valueBuffer |
protected int |
valueCount |
allocator, fieldReader, INITIAL_VALUE_ALLOCATION, MAX_ALLOCATION_SIZE, MAX_ALLOCATION_SIZE_PROPERTY| Constructor and Description |
|---|
BaseFixedWidthVector(Field field,
BufferAllocator allocator,
int typeWidth)
Constructs a new instance.
|
| Modifier and Type | Method and Description |
|---|---|
<OUT,IN> OUT |
accept(VectorVisitor<OUT,IN> visitor,
IN value)
Accept a generic
VectorVisitor and return the result. |
void |
allocateNew()
Same as
allocateNewSafe(). |
void |
allocateNew(int valueCount)
Allocate memory for the vector to support storing at least the provided number of
elements in the vector.
|
boolean |
allocateNewSafe()
Allocate memory for the vector.
|
void |
clear()
Same as
close(). |
void |
close()
Close the vector and release the associated buffers.
|
void |
copyFrom(int fromIndex,
int thisIndex,
ValueVector from)
Copy a cell value from a particular index in source vector to a particular
position in this vector.
|
void |
copyFromSafe(int fromIndex,
int thisIndex,
ValueVector from)
Same as
copyFrom(int, int, ValueVector) except that
it handles the case when the capacity of the vector needs to be expanded
before copy. |
protected void |
decrementAllocationMonitor() |
ArrowBuf[] |
getBuffers(boolean clear)
Return the underlying buffers associated with this vector.
|
int |
getBufferSize()
Get the size (number of bytes) of underlying buffers used by this
vector.
|
int |
getBufferSizeFor(int count)
Get the potential buffer size for a particular number of records.
|
List<FieldVector> |
getChildrenFromFields()
Get the inner child vectors.
|
ArrowBuf |
getDataBuffer()
Get the buffer that stores the data for elements in the vector.
|
long |
getDataBufferAddress()
Get the memory address of buffer that stores the data for elements
in the vector.
|
ArrowBufPointer |
getDataPointer(int index)
Gets the pointer for the data at the given index.
|
ArrowBufPointer |
getDataPointer(int index,
ArrowBufPointer reuse)
Gets the pointer for the data at the given index.
|
Field |
getField()
Get information about how this field is materialized.
|
List<ArrowBuf> |
getFieldBuffers()
Get the buffers belonging to this vector.
|
List<BufferBacked> |
getFieldInnerVectors()
Deprecated.
This API will be removed as the current implementations no longer support inner vectors.
|
String |
getName()
Gets the name of the vector.
|
int |
getNullCount()
Get the number of elements that are null in the vector.
|
ArrowBuf |
getOffsetBuffer()
buffer that stores the offsets for elements
in the vector.
|
long |
getOffsetBufferAddress()
Get the memory address of buffer that stores the offsets for elements
in the vector.
|
TransferPair |
getTransferPair(BufferAllocator allocator)
Construct a transfer pair of this vector and another vector of same type.
|
abstract TransferPair |
getTransferPair(Field field,
BufferAllocator allocator)
Construct a transfer pair of this vector and another vector of same type.
|
TransferPair |
getTransferPair(Field field,
BufferAllocator allocator,
CallBack callBack)
Construct a transfer pair of this vector and another vector of same type.
|
abstract TransferPair |
getTransferPair(String ref,
BufferAllocator allocator)
Construct a transfer pair of this vector and another vector of same type.
|
TransferPair |
getTransferPair(String ref,
BufferAllocator allocator,
CallBack callBack)
Construct a transfer pair of this vector and another vector of same type.
|
int |
getTypeWidth() |
ArrowBuf |
getValidityBuffer()
Get buffer that manages the validity (NULL or NON-NULL nature) of
elements in the vector.
|
long |
getValidityBufferAddress()
Get the memory address of buffer that manages the validity
(NULL or NON-NULL nature) of elements in the vector.
|
protected int |
getValidityBufferValueCapacity() |
protected int |
getValueBufferValueCapacity() |
int |
getValueCapacity()
Get the current value capacity for the vector.
|
int |
getValueCount()
Get the value count of vector.
|
protected void |
handleSafe(int index) |
int |
hashCode(int index)
Returns hashCode of element in index with the default hasher.
|
int |
hashCode(int index,
ArrowBufHasher hasher)
Returns hashCode of element in index with the given hasher.
|
protected void |
incrementAllocationMonitor() |
void |
initializeChildrenFromFields(List<Field> children)
Initialize the children in schema for this Field.
|
boolean |
isNull(int index)
Check if element at given index is null.
|
boolean |
isSafe(int index)
Check if the given index is within the current value capacity
of the vector.
|
int |
isSet(int index)
Same as
isNull(int). |
void |
loadFieldBuffers(ArrowFieldNode fieldNode,
List<ArrowBuf> ownBuffers)
Load the buffers of this vector with provided source buffers.
|
void |
reAlloc()
Resize the vector to increase the capacity.
|
protected void |
refreshValueCapacity()
Call this if you change the capacity of valueBuffer or validityBuffer.
|
void |
reset()
Reset the vector to initial state.
|
void |
set(int index,
byte[] value,
int start,
int length) |
void |
set(int index,
ByteBuffer value,
int start,
int length) |
void |
setIndexDefined(int index)
Mark the particular position in the vector as non-null.
|
void |
setInitialCapacity(int valueCount)
Sets the desired value capacity for the vector.
|
void |
setNull(int index)
Set the element at the given index to null.
|
void |
setSafe(int index,
byte[] value,
int start,
int length) |
void |
setSafe(int index,
ByteBuffer value,
int start,
int length) |
void |
setValueCount(int valueCount)
Set value count for the vector.
|
void |
splitAndTransferTo(int startIndex,
int length,
BaseFixedWidthVector target)
Slice this vector at desired index and length and transfer the
corresponding data to the target vector.
|
void |
transferTo(BaseFixedWidthVector target)
Transfer this vector's data to another vector.
|
void |
validateScalars()
Validate the scalar values held by this vector.
|
void |
zeroVector()
zero out the vector and the data in associated buffers.
|
checkBufRefs, getAllocator, getReader, getReaderImpl, getValidityBufferSizeFromCount, iterator, releaseBuffer, toString, transferBufferclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetAllocator, getMinorType, getObject, getReader, makeTransferPair, validate, validateFullforEach, iterator, spliteratorexportBuffer, exportCDataBuffersprotected int lastValueCapacity
protected int actualValueCapacity
protected final Field field
protected ArrowBuf validityBuffer
protected ArrowBuf valueBuffer
protected int valueCount
public BaseFixedWidthVector(Field field, BufferAllocator allocator, int typeWidth)
field - field materialized by this vectorallocator - The allocator to use for allocating memory for the vector.typeWidth - The width in bytes of the type.public int getTypeWidth()
public String getName()
ValueVectorgetName in interface ValueVectorgetName in class BaseValueVectorpublic long getValidityBufferAddress()
getValidityBufferAddress in interface FieldVectorpublic long getDataBufferAddress()
getDataBufferAddress in interface FieldVectorpublic long getOffsetBufferAddress()
getOffsetBufferAddress in interface FieldVectorUnsupportedOperationException - for fixed width vectorspublic ArrowBuf getValidityBuffer()
getValidityBuffer in interface ValueVectorpublic ArrowBuf getDataBuffer()
getDataBuffer in interface ValueVectorpublic ArrowBuf getOffsetBuffer()
getOffsetBuffer in interface ValueVectorUnsupportedOperationException - for fixed width vectorspublic void setInitialCapacity(int valueCount)
setInitialCapacity in interface ValueVectorvalueCount - desired number of elements in the vectorpublic int getValueCapacity()
getValueCapacity in interface ValueVectorprotected void refreshValueCapacity()
protected int getValueBufferValueCapacity()
protected int getValidityBufferValueCapacity()
public void zeroVector()
zeroVector in interface FixedWidthVectorpublic void reset()
zeroVector().
Note that this method doesn't release any memory.reset in interface ValueVectorpublic void close()
close in interface Closeableclose in interface AutoCloseableclose in interface ValueVectorclose in class BaseValueVectorpublic void clear()
close().clear in interface ValueVectorclear in class BaseValueVectorprotected void incrementAllocationMonitor()
protected void decrementAllocationMonitor()
public void allocateNew()
allocateNewSafe().allocateNew in interface ValueVectorpublic boolean allocateNewSafe()
allocateNew(int) for allocating memory for specific
number of elements in the vector.allocateNewSafe in interface ValueVectorpublic void allocateNew(int valueCount)
allocateNew in interface FixedWidthVectorvalueCount - the desired number of elements in the vectorOutOfMemoryException - on errorpublic int getBufferSizeFor(int count)
getBufferSizeFor in interface ValueVectorcount - desired number of elements in the vectorpublic int getBufferSize()
getBufferSize in interface ValueVectorpublic Field getField()
getField in interface ValueVectorpublic ArrowBuf[] getBuffers(boolean clear)
getBuffers in interface ValueVectorclear - Whether to clear vector before returning; the buffers will still be refcounted
but the returned array will be the only reference to thembuffers that is used by this
vector instance.public void reAlloc()
reAlloc in interface ValueVector@Deprecated public List<BufferBacked> getFieldInnerVectors()
getFieldInnerVectors in interface FieldVectorpublic void initializeChildrenFromFields(List<Field> children)
initializeChildrenFromFields in interface FieldVectorchildren - the schemaIllegalArgumentException - if children is a non-empty list for scalar types.public List<FieldVector> getChildrenFromFields()
getChildrenFromFields in interface FieldVectorpublic void loadFieldBuffers(ArrowFieldNode fieldNode, List<ArrowBuf> ownBuffers)
loadFieldBuffers in interface FieldVectorfieldNode - the fieldNode indicating the value countownBuffers - the buffers for this Field (own buffers only, children not included)public List<ArrowBuf> getFieldBuffers()
getFieldBuffers in interface FieldVectorpublic void validateScalars()
public TransferPair getTransferPair(String ref, BufferAllocator allocator, CallBack callBack)
getTransferPair in interface ValueVectorref - name of the target vectorallocator - allocator for the target vectorcallBack - not usedpublic TransferPair getTransferPair(Field field, BufferAllocator allocator, CallBack callBack)
getTransferPair in interface ValueVectorfield - The field materialized by this vector.allocator - allocator for the target vectorcallBack - not usedpublic TransferPair getTransferPair(BufferAllocator allocator)
getTransferPair in interface ValueVectorgetTransferPair in class BaseValueVectorallocator - allocator for the target vectorpublic abstract TransferPair getTransferPair(String ref, BufferAllocator allocator)
getTransferPair in interface ValueVectorref - name of the target vectorallocator - allocator for the target vectorpublic abstract TransferPair getTransferPair(Field field, BufferAllocator allocator)
getTransferPair in interface ValueVectorfield - Field object used by the target vectorallocator - allocator for the target vectorpublic void transferTo(BaseFixedWidthVector target)
target - destination vector for transferpublic void splitAndTransferTo(int startIndex,
int length,
BaseFixedWidthVector target)
startIndex - start position of the split in source vector.length - length of the split.target - destination vectorpublic int getNullCount()
getNullCount in interface ValueVectorpublic int getValueCount()
setValueCount(int) has been called prior to calling this.getValueCount in interface ValueVectorpublic void setValueCount(int valueCount)
setValueCount in interface ValueVectorvalueCount - value count to setpublic boolean isSafe(int index)
index - position to checkpublic boolean isNull(int index)
isNull in interface ValueVectorindex - position of elementpublic int isSet(int index)
isNull(int).index - position of elementpublic void setIndexDefined(int index)
setIndexDefined in interface VectorDefinitionSetterindex - position of the element.public void set(int index,
byte[] value,
int start,
int length)
public void setSafe(int index,
byte[] value,
int start,
int length)
public void set(int index,
ByteBuffer value,
int start,
int length)
public void setSafe(int index,
ByteBuffer value,
int start,
int length)
protected void handleSafe(int index)
public void copyFrom(int fromIndex,
int thisIndex,
ValueVector from)
copyFrom in interface ValueVectorcopyFrom in class BaseValueVectorfromIndex - position to copy from in source vectorthisIndex - position to copy to in this vectorfrom - source vectorpublic void copyFromSafe(int fromIndex,
int thisIndex,
ValueVector from)
copyFrom(int, int, ValueVector) except that
it handles the case when the capacity of the vector needs to be expanded
before copy.copyFromSafe in interface ValueVectorcopyFromSafe in class BaseValueVectorfromIndex - position to copy from in source vectorthisIndex - position to copy to in this vectorfrom - source vectorpublic void setNull(int index)
setNull in interface FieldVectorindex - position of elementpublic ArrowBufPointer getDataPointer(int index)
ElementAddressableVectorgetDataPointer in interface ElementAddressableVectorindex - the index for the data.public ArrowBufPointer getDataPointer(int index, ArrowBufPointer reuse)
ElementAddressableVectorgetDataPointer in interface ElementAddressableVectorindex - the index for the data.reuse - the data pointer to fill, this avoids creating a new pointer object.public int hashCode(int index)
ValueVectorhashCode in interface ValueVectorpublic int hashCode(int index,
ArrowBufHasher hasher)
ValueVectorhashCode in interface ValueVectorpublic <OUT,IN> OUT accept(VectorVisitor<OUT,IN> visitor, IN value)
ValueVectorVectorVisitor and return the result.accept in interface ValueVectorOUT - the output result type.IN - the input data together with visitor.Copyright © 2024 The Apache Software Foundation. All rights reserved.