- All Implemented Interfaces:
Closeable,AutoCloseable,Iterable<ValueVector>,DensityAwareVector,ElementAddressableVector,FieldVector,ValueVector,VariableWidthFieldVector,VariableWidthVector,VectorDefinitionSetter
- Direct Known Subclasses:
LargeVarBinaryVector,LargeVarCharVector
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final byte[]protected final Fieldprotected intstatic final intprotected ArrowBufprotected ArrowBufFields inherited from class org.apache.arrow.vector.BaseValueVector
allocator, fieldReader, INITIAL_VALUE_ALLOCATION, MAX_ALLOCATION_SIZE, MAX_ALLOCATION_SIZE_PROPERTY, validityBuffer, valueCount -
Constructor Summary
ConstructorsConstructorDescriptionBaseLargeVariableWidthVector(Field field, BufferAllocator allocator) 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.voidSame asallocateNewSafe().voidallocateNew(int valueCount) Allocate a new memory space for this vector.voidallocateNew(long totalBytes, int valueCount) Allocate memory for the vector to support storing at least the provided number of elements in the vector.booleanAllocate memory for the vector.protected voidallocateValidityBuffer(long size) Allocate new validity buffer for when the bytes need to be copied over.voidclear()Same asclose().voidclose()Close the vector and release the associated buffers.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 ascopyFrom(int, int, ValueVector)except that it handles the case when the capacity of the vector needs to be expanded before copy.voidexportCDataBuffers(List<ArrowBuf> buffers, ArrowBuf buffersPtr, long nullValue) Export the buffers of the fields for C Data Interface.voidfillEmpties(int index) Create holes in the vector upto the given index (exclusive).protected final voidfillHoles(int index) static byte[]Method used by Json Writer to read a variable width element from the variable width vector and write to Json.ArrowBuf[]getBuffers(boolean clear) Return the underlying buffers associated with this vector.intGet the size (number of bytes) of underlying buffers used by this vector.intgetBufferSizeFor(int valueCount) Get the potential buffer size for a particular number of records.intGet the size (number of bytes) of underlying data buffer.Get the inner child vectors.Get the buffer that stores the data for elements in the vector.longGet the memory address of buffer that stores the data for elements in the vector.getDataPointer(int index) Gets the pointer for the data at the given index.getDataPointer(int index, ArrowBufPointer reuse) Gets the pointer for the data at the given index.doubleGet the density of this ListVector.protected final longgetEndOffset(int index) getField()Get information about how this field is materialized.Get the buffers belonging to this vector.Deprecated.This API will be removed as the current implementations no longer support inner vectors.intGet the index of last non-null element in the vector.getName()Gets the name of the vector.intGet the number of elements that are null in the vector.buffer that stores the offsets for elements in the vector.longGet the memory address of buffer that stores the offsets for elements in the vector.protected final longgetStartOffset(int index) Gets the starting offset of a record, given its index.abstract TransferPairgetTransferPair(String ref, BufferAllocator allocator) Construct a transfer pair of this vector and another vector of same type.getTransferPair(String ref, BufferAllocator allocator, CallBack callBack) Construct a transfer pair of this vector and another vector of same type.getTransferPair(BufferAllocator allocator) Construct a transfer pair of this vector and another vector of same type.abstract TransferPairgetTransferPair(Field field, BufferAllocator allocator) Construct a transfer pair of this vector and another vector of same type.getTransferPair(Field field, BufferAllocator allocator, CallBack callBack) Construct a transfer pair of this vector and another vector of same type.Get buffer that manages the validity (NULL or NON-NULL nature) of elements in the vector.longGet the memory address of buffer that manages the validity (NULL or NON-NULL nature) of elements in the vector.intGet the current capacity which does not exceed either validity buffer or offset buffer.intGet the value count of vector.intgetValueLength(int index) Get the variable length element at specified index as Text.protected final voidhandleSafe(int index, int dataLength) 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) Initialize the children in schema for this Field.booleanisNull(int index) Check if element at given index is null.booleanisSafe(int index) Check if the given index is within the current value capacity of the vector.intisSet(int index) Same asisNull(int).voidloadFieldBuffers(ArrowFieldNode fieldNode, List<ArrowBuf> ownBuffers) Load the buffers of this vector with provided source buffers.voidreAlloc()Resize the vector to increase the capacity.voidReallocate the data buffer.voidReallocate the validity and offset buffers for this vector.voidreset()Reset the vector to initial state.voidset(int index, byte[] value) Set the variable length element at the specified index to the supplied byte array.voidset(int index, byte[] value, int start, int length) Set the variable length element at the specified index to the supplied byte array.voidStore the given value at a particular position in the vector. isSet indicates whether the value is NULL or not.voidStore the given value at a particular position in the vector. isSet indicates whether the value is NULL or not.voidset(int index, ByteBuffer value, int start, int length) Set the variable length element at the specified index to the content in supplied ByteBuffer.static ArrowBufset(ArrowBuf buffer, BufferAllocator allocator, int valueCount, int index, long value) Method used by Json Reader to explicitly set the offsets of the variable width vector data.protected final voidsetBytes(int index, byte[] value, int start, int length) voidsetIndexDefined(int index) Mark the particular position in the vector as non-null.voidsetInitialCapacity(int valueCount) Sets the desired value capacity for the vector.voidsetInitialCapacity(int valueCount, double density) Sets the desired value capacity for the vector.voidsetLastSet(int value) Set the index of last non-null element in the vector.voidsetNull(int index) Set the element at the given index to null.voidsetSafe(int index, byte[] value) Same asset(int, byte[])except that it handles the case where index and length of new element are beyond the existing capacity of the vector.voidsetSafe(int index, byte[] value, int start, int length) Same asset(int, byte[], int, int)except that it handles the case where index and length of new element are beyond the existing capacity of the vector.voidSame asset(int, int, long, long, ArrowBuf)except that it handles the case when index is greater than or equal to current value capacity of the vector.voidSame asset(int, int, long, long, ArrowBuf)except that it handles the case when index is greater than or equal to current value capacity of the vector.voidsetSafe(int index, ByteBuffer value, int start, int length) Same asset(int, ByteBuffer, int, int)except that it handles the case where index and length of new element are beyond the existing capacity of the vector.voidsetValueCount(int valueCount) Sets the value count for the vector.voidsetValueLengthSafe(int index, int length) Sets the value length for an element.intProvide the number of bytes contained in the valueBuffer.protected voidsliceAndTransferValidityBuffer(int startIndex, int length, BaseValueVector target) If the start index is 8 byte aligned, slice `validityBuffer` and transfer ownership to `target`'s `validityBuffer`.voidsplitAndTransferTo(int startIndex, int length, BaseLargeVariableWidthVector target) Slice this vector at desired index and length and transfer the corresponding data to the target vector.voidTransfer this vector's data to another vector.voidValidate the scalar values held by this vector.voidzero out the vector and the data in associated buffers.Methods inherited from class org.apache.arrow.vector.BaseValueVector
checkBufRefs, copyValidityBuffer, getAllocator, getReader, getReaderImpl, getValidityBufferSizeFromCount, iterator, releaseBuffer, 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, getExportedCDataBufferCountMethods inherited from interface java.lang.Iterable
forEach, iterator, spliteratorMethods inherited from interface org.apache.arrow.vector.ValueVector
getAllocator, getMinorType, getObject, getReader, makeTransferPair, validate, validateFullMethods inherited from interface org.apache.arrow.vector.VariableWidthFieldVector
get, read
-
Field Details
-
OFFSET_WIDTH
public static final int OFFSET_WIDTH- See Also:
-
emptyByteArray
protected static final byte[] emptyByteArray -
valueBuffer
-
offsetBuffer
-
lastSet
protected int lastSet -
field
-
-
Constructor Details
-
BaseLargeVariableWidthVector
Constructs a new instance.- Parameters:
field- The field materialized by this vector.allocator- The allocator to use for creating/resizing buffers
-
-
Method Details
-
getName
Description copied from interface:ValueVectorGets the name of the vector.- Specified by:
getNamein interfaceValueVector- Specified by:
getNamein classBaseValueVector- Returns:
- the name of the vector.
-
getValidityBuffer
Get buffer that manages the validity (NULL or NON-NULL nature) of elements in the vector. Consider it as a buffer for internal bit vector data structure.- Specified by:
getValidityBufferin interfaceValueVector- Returns:
- buffer
-
getDataBuffer
Get the buffer that stores the data for elements in the vector.- Specified by:
getDataBufferin interfaceValueVector- Returns:
- buffer
-
getOffsetBuffer
buffer that stores the offsets for elements in the vector. This operation is not supported for fixed-width vectors.- Specified by:
getOffsetBufferin interfaceValueVector- Returns:
- buffer
-
getOffsetBufferAddress
public long getOffsetBufferAddress()Get the memory address of buffer that stores the offsets for elements in the vector.- Specified by:
getOffsetBufferAddressin interfaceFieldVector- Returns:
- starting address of the buffer
-
getValidityBufferAddress
public long getValidityBufferAddress()Get the memory address of buffer that manages the validity (NULL or NON-NULL nature) of elements in the vector.- Specified by:
getValidityBufferAddressin interfaceFieldVector- Returns:
- starting address of the buffer
-
getDataBufferAddress
public long getDataBufferAddress()Get the memory address of buffer that stores the data for elements in the vector.- Specified by:
getDataBufferAddressin interfaceFieldVector- Returns:
- starting address of the buffer
-
setInitialCapacity
public void setInitialCapacity(int valueCount) Sets the desired value capacity for the vector. This function doesn't allocate any memory for the vector.- Specified by:
setInitialCapacityin interfaceValueVector- Parameters:
valueCount- desired number of elements in the vector
-
setInitialCapacity
public void setInitialCapacity(int valueCount, double density) Sets the desired value capacity for the vector. This function doesn't allocate any memory for the vector.- Specified by:
setInitialCapacityin interfaceDensityAwareVector- Parameters:
valueCount- desired number of elements in the vectordensity- average number of bytes per variable width element
-
getDensity
public double getDensity()Get the density of this ListVector.- Returns:
- density
-
getValueCapacity
public int getValueCapacity()Get the current capacity which does not exceed either validity buffer or offset buffer. Note: Here the `getValueCapacity` has no relationship with the value buffer.- Specified by:
getValueCapacityin interfaceValueVector- Returns:
- number of elements that vector can hold.
-
zeroVector
public void zeroVector()zero out the vector and the data in associated buffers. -
reset
public void reset()Reset the vector to initial state. Same aszeroVector(). Note that this method doesn't release any memory.- Specified by:
resetin interfaceValueVector
-
close
public void close()Close the vector and release the associated buffers.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceValueVector- Overrides:
closein classBaseValueVector
-
clear
public void clear()Same asclose().- Specified by:
clearin interfaceValueVector- Overrides:
clearin classBaseValueVector
-
getFieldInnerVectors
Deprecated.This API will be removed as the current implementations no longer support inner vectors.Get the inner vectors.- Specified by:
getFieldInnerVectorsin interfaceFieldVector- Returns:
- the inner vectors for this field as defined by the TypeLayout
-
initializeChildrenFromFields
Initialize the children in schema for this Field. This operation is a NO-OP for scalar types since they don't have any children.- Specified by:
initializeChildrenFromFieldsin interfaceFieldVector- Parameters:
children- the schema- Throws:
IllegalArgumentException- if children is a non-empty list for scalar types.
-
getChildrenFromFields
Get the inner child vectors.- Specified by:
getChildrenFromFieldsin interfaceFieldVector- Returns:
- list of child vectors for complex types, empty list for scalar vector types
-
loadFieldBuffers
Load the buffers of this vector with provided source buffers. The caller manages the source buffers and populates them before invoking this method.- Specified by:
loadFieldBuffersin interfaceFieldVector- Parameters:
fieldNode- the fieldNode indicating the value countownBuffers- the buffers for this Field (own buffers only, children not included)
-
getFieldBuffers
Get the buffers belonging to this vector.- Specified by:
getFieldBuffersin interfaceFieldVector- Returns:
- the inner buffers.
-
exportCDataBuffers
Export the buffers of the fields for C Data Interface. This method traverse the buffers and export buffer and buffer's memory address into a list of buffers and a pointer to the list of buffers.- Specified by:
exportCDataBuffersin interfaceFieldVector
-
allocateNew
public void allocateNew()Same asallocateNewSafe().- Specified by:
allocateNewin interfaceValueVector
-
allocateNewSafe
public boolean allocateNewSafe()Allocate memory for the vector. We internally use a default value count of 4096 to allocate memory for at least these many elements in the vector. SeeallocateNew(long, int)for allocating memory for specific number of elements in the vector.- Specified by:
allocateNewSafein interfaceValueVector- Returns:
- false if memory allocation fails, true otherwise.
-
allocateNew
public void allocateNew(long totalBytes, int valueCount) Allocate memory for the vector to support storing at least the provided number of elements in the vector. This method must be called prior to using the ValueVector.- Specified by:
allocateNewin interfaceVariableWidthVector- Parameters:
totalBytes- desired total memory capacityvalueCount- the desired number of elements in the vector- Throws:
OutOfMemoryException- if memory allocation fails
-
allocateNew
public void allocateNew(int valueCount) Description copied from interface:VariableWidthVectorAllocate a new memory space for this vector. Must be called prior to using the ValueVector. The initial size in bytes is either default (or) reused from previous allocation- Specified by:
allocateNewin interfaceVariableWidthVector- Parameters:
valueCount- Number of values in the vector.
-
allocateValidityBuffer
protected void allocateValidityBuffer(long size) Description copied from class:BaseValueVectorAllocate new validity buffer for when the bytes need to be copied over.- Overrides:
allocateValidityBufferin classBaseValueVector- Parameters:
size- desired size of the buffer
-
reAlloc
public void reAlloc()Resize the vector to increase the capacity. The internal behavior is to double the current value capacity.- Specified by:
reAllocin interfaceValueVector
-
reallocDataBuffer
public void reallocDataBuffer()Reallocate the data buffer. Data Buffer stores the actual data for LARGEVARCHAR or LARGEVARBINARY elements in the vector. The behavior is to double the size of buffer.- Throws:
OversizedAllocationException- if the desired new size is more than max allowedOutOfMemoryException- if the internal memory allocation fails
-
reallocValidityAndOffsetBuffers
public void reallocValidityAndOffsetBuffers()Reallocate the validity and offset buffers for this vector. Validity buffer is used to track the NULL or NON-NULL nature of elements in the vector and offset buffer is used to store the lengths of variable width elements in the vector.Note that data buffer for variable length vectors moves independent of the companion validity and offset buffers. This is in contrast to what we have for fixed width vectors.
So even though we may have setup an initial capacity of 1024 elements in the vector, it is quite possible that we need to reAlloc() the data buffer when we are setting the 5th element in the vector simply because previous variable length elements have exhausted the buffer capacity. However, we really don't need to reAlloc() validity and offset buffers until we try to set the 1025th element This is why we do a separate check for safe methods to determine which buffer needs reallocation.
- Throws:
OversizedAllocationException- if the desired new size is more than max allowedOutOfMemoryException- if the internal memory allocation fails
-
getByteCapacity
public int getByteCapacity()Get the size (number of bytes) of underlying data buffer.- Specified by:
getByteCapacityin interfaceVariableWidthVector- Returns:
- number of bytes in the data buffer
-
sizeOfValueBuffer
public int sizeOfValueBuffer()Description copied from interface:VariableWidthVectorProvide the number of bytes contained in the valueBuffer.- Specified by:
sizeOfValueBufferin interfaceVariableWidthVector- Returns:
- the number of bytes in valueBuffer.
-
getBufferSize
public int getBufferSize()Get the size (number of bytes) of underlying buffers used by this vector.- Specified by:
getBufferSizein interfaceValueVector- Returns:
- size of underlying buffers.
-
getBufferSizeFor
public int getBufferSizeFor(int valueCount) Get the potential buffer size for a particular number of records.- Specified by:
getBufferSizeForin interfaceValueVector- Parameters:
valueCount- desired number of elements in the vector- Returns:
- estimated size of underlying buffers if the vector holds a given number of elements
-
getField
Get information about how this field is materialized.- Specified by:
getFieldin interfaceValueVector- Returns:
- the field corresponding to this vector
-
getBuffers
Return the underlying buffers associated with this vector. Note that this doesn't impact the reference counts for this buffer so it only should be used for in-context access. Also note that this buffer changes regularly thus external classes shouldn't hold a reference to it (unless they change it).- Specified by:
getBuffersin interfaceValueVector- Parameters:
clear- Whether to clear vector before returning; the buffers will still be refcounted but the returned array will be the only reference to them- Returns:
- The underlying
buffersthat is used by this vector instance.
-
validateScalars
public void validateScalars()Validate the scalar values held by this vector. -
getTransferPair
Construct a transfer pair of this vector and another vector of same type.- Specified by:
getTransferPairin interfaceValueVector- Parameters:
ref- name of the target vectorallocator- allocator for the target vectorcallBack- not used- Returns:
- TransferPair
-
getTransferPair
Construct a transfer pair of this vector and another vector of same type.- Specified by:
getTransferPairin interfaceValueVector- Parameters:
field- The field materialized by this vectorallocator- allocator for the target vectorcallBack- not used- Returns:
- TransferPair
-
getTransferPair
Construct a transfer pair of this vector and another vector of same type.- Specified by:
getTransferPairin interfaceValueVector- Overrides:
getTransferPairin classBaseValueVector- Parameters:
allocator- allocator for the target vector- Returns:
- TransferPair
-
getTransferPair
Construct a transfer pair of this vector and another vector of same type.- Specified by:
getTransferPairin interfaceValueVector- Parameters:
ref- name of the target vectorallocator- allocator for the target vector- Returns:
- TransferPair
-
getTransferPair
Construct a transfer pair of this vector and another vector of same type.- Specified by:
getTransferPairin interfaceValueVector- Parameters:
field- The field materialized by this vectorallocator- allocator for the target vector- Returns:
- TransferPair
-
transferTo
Transfer this vector's data to another vector. The memory associated with this vector is transferred to the allocator of target vector for accounting and management purposes.- Parameters:
target- destination vector for transfer
-
splitAndTransferTo
Slice this vector at desired index and length and transfer the corresponding data to the target vector.- Parameters:
startIndex- start position of the split in source vector.length- length of the split.target- destination vector
-
sliceAndTransferValidityBuffer
Description copied from class:BaseValueVectorIf the start index is 8 byte aligned, slice `validityBuffer` and transfer ownership to `target`'s `validityBuffer`.- Overrides:
sliceAndTransferValidityBufferin classBaseValueVector- Parameters:
startIndex- starting indexlength- number of elements to be copiedtarget- target vector
-
getNullCount
public int getNullCount()Get the number of elements that are null in the vector.- Specified by:
getNullCountin interfaceValueVector- Returns:
- the number of null elements.
-
isSafe
public boolean isSafe(int index) Check if the given index is within the current value capacity of the vector.- Parameters:
index- position to check- Returns:
- true if index is within the current value capacity
-
isNull
public boolean isNull(int index) Check if element at given index is null.- Specified by:
isNullin interfaceValueVector- Parameters:
index- position of element- Returns:
- true if element at given index is null
-
isSet
public int isSet(int index) Same asisNull(int).- Parameters:
index- position of element- Returns:
- 1 if element at given index is not null, 0 otherwise
-
getValueCount
public int getValueCount()Get the value count of vector. This will always be zero unless setValueCount(int) has been called prior to calling this.- Specified by:
getValueCountin interfaceValueVector- Returns:
- valueCount for the vector
-
setValueCount
public void setValueCount(int valueCount) Sets the value count for the vector.- Specified by:
setValueCountin interfaceValueVector- Parameters:
valueCount- value count
-
fillEmpties
public void fillEmpties(int index) Create holes in the vector upto the given index (exclusive). Holes will be created from the current last set position in the vector.- Specified by:
fillEmptiesin interfaceVariableWidthFieldVector- Parameters:
index- target index
-
setLastSet
public void setLastSet(int value) Set the index of last non-null element in the vector. It is important to call this method with appropriate value before callingsetValueCount(int).- Specified by:
setLastSetin interfaceVariableWidthFieldVector- Parameters:
value- desired index of last non-null element.
-
getLastSet
public int getLastSet()Get the index of last non-null element in the vector.- Specified by:
getLastSetin interfaceVariableWidthFieldVector- Returns:
- index of the last non-null element
-
setIndexDefined
public void setIndexDefined(int index) Mark the particular position in the vector as non-null.- Specified by:
setIndexDefinedin interfaceVectorDefinitionSetter- Parameters:
index- position of the element.
-
setValueLengthSafe
public void setValueLengthSafe(int index, int length) Sets the value length for an element.- Specified by:
setValueLengthSafein interfaceVariableWidthFieldVector- Parameters:
index- position of the element to setlength- length of the element
-
getValueLength
public int getValueLength(int index) Get the variable length element at specified index as Text.- Specified by:
getValueLengthin interfaceVariableWidthFieldVector- Parameters:
index- position of element to get- Returns:
- greater than 0 length for non-null element, 0 otherwise
-
set
public void set(int index, byte[] value) Set the variable length element at the specified index to the supplied byte array. This is same as usingset(int, byte[], int, int)with start as 0 and length as value.length- Specified by:
setin interfaceVariableWidthFieldVector- Parameters:
index- position of the element to setvalue- array of bytes to write
-
setSafe
public void setSafe(int index, byte[] value) Same asset(int, byte[])except that it handles the case where index and length of new element are beyond the existing capacity of the vector.- Specified by:
setSafein interfaceVariableWidthFieldVector- Parameters:
index- position of the element to setvalue- array of bytes to write
-
set
public void set(int index, byte[] value, int start, int length) Set the variable length element at the specified index to the supplied byte array.- Specified by:
setin interfaceVariableWidthFieldVector- Parameters:
index- position of the element to setvalue- array of bytes to writestart- start index in array of byteslength- length of data in array of bytes
-
setSafe
public void setSafe(int index, byte[] value, int start, int length) Same asset(int, byte[], int, int)except that it handles the case where index and length of new element are beyond the existing capacity of the vector.- Specified by:
setSafein interfaceVariableWidthFieldVector- Parameters:
index- position of the element to setvalue- array of bytes to writestart- start index in array of byteslength- length of data in array of bytes
-
set
Set the variable length element at the specified index to the content in supplied ByteBuffer.- Specified by:
setin interfaceVariableWidthFieldVector- Parameters:
index- position of the element to setvalue- ByteBuffer with datastart- start index in ByteBufferlength- length of data in ByteBuffer
-
setSafe
Same asset(int, ByteBuffer, int, int)except that it handles the case where index and length of new element are beyond the existing capacity of the vector.- Specified by:
setSafein interfaceVariableWidthFieldVector- Parameters:
index- position of the element to setvalue- ByteBuffer with datastart- start index in ByteBufferlength- length of data in ByteBuffer
-
setNull
public void setNull(int index) Set the element at the given index to null.- Specified by:
setNullin interfaceFieldVector- Parameters:
index- position of element
-
set
Store the given value at a particular position in the vector. isSet indicates whether the value is NULL or not.- Parameters:
index- position of the new valueisSet- 0 for NULL value, 1 otherwisestart- start position of data in bufferend- end position of data in bufferbuffer- data buffer containing the variable width element to be stored in the vector
-
setSafe
Same asset(int, int, long, long, ArrowBuf)except that it handles the case when index is greater than or equal to current value capacity of the vector.- Parameters:
index- position of the new valueisSet- 0 for NULL value, 1 otherwisestart- start position of data in bufferend- end position of data in bufferbuffer- data buffer containing the variable width element to be stored in the vector
-
set
Store the given value at a particular position in the vector. isSet indicates whether the value is NULL or not.- Parameters:
index- position of the new valuestart- start position of data in bufferlength- length of data in bufferbuffer- data buffer containing the variable width element to be stored in the vector
-
setSafe
Same asset(int, int, long, long, ArrowBuf)except that it handles the case when index is greater than or equal to current value capacity of the vector.- Parameters:
index- position of the new valuestart- start position of data in bufferlength- length of data in bufferbuffer- data buffer containing the variable width element to be stored in the vector
-
fillHoles
protected final void fillHoles(int index) -
setBytes
protected final void setBytes(int index, byte[] value, int start, int length) -
getStartOffset
protected final long getStartOffset(int index) Gets the starting offset of a record, given its index.- Parameters:
index- index of the record.- Returns:
- the starting offset of the record.
-
handleSafe
protected final void handleSafe(int index, int dataLength) -
get
Method used by Json Writer to read a variable width element from the variable width vector and write to Json.This method should not be used externally.
- Parameters:
data- buffer storing the variable width vector elementsoffset- buffer storing the offsets of variable width vector elementsindex- position of the element in the vector- Returns:
- array of bytes
-
set
public static ArrowBuf set(ArrowBuf buffer, BufferAllocator allocator, int valueCount, int index, long value) Method used by Json Reader to explicitly set the offsets of the variable width vector data. The method takes care of allocating the memory for offsets if the caller hasn't done so.This method should not be used externally.
- Parameters:
buffer- ArrowBuf to store offsets for variable width elementsallocator- memory allocatorvalueCount- number of elementsindex- position of the elementvalue- offset of the element- Returns:
- buffer holding the offsets
-
copyFrom
Copy 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
Same ascopyFrom(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
-
getDataPointer
Description copied from interface:ElementAddressableVectorGets the pointer for the data at the given index.- Specified by:
getDataPointerin interfaceElementAddressableVector- Parameters:
index- 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:
index- the index for the data.reuse- 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
-
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.
-
getEndOffset
protected final long getEndOffset(int index)
-