java.lang.Object
org.apache.arrow.vector.BaseValueVector
- All Implemented Interfaces:
Closeable,AutoCloseable,Iterable<ValueVector>,ValueVector
- Direct Known Subclasses:
BaseFixedWidthVector,BaseLargeRepeatedValueViewVector,BaseLargeVariableWidthVector,BaseRepeatedValueVector,BaseRepeatedValueViewVector,BaseVariableWidthVector,BaseVariableWidthViewVector,ExtensionTypeVector,FixedSizeListVector,LargeListVector,RunEndEncodedVector
Base class for other Arrow Vector Types. Provides basic functionality around memory management.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final BufferAllocatorprotected FieldReaderstatic final intstatic final longstatic final Stringprotected ArrowBufprotected int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidallocateValidityBuffer(long byteSizeTarget) Allocate new validity buffer for when the bytes need to be copied over.static booleanChecks to ensure that every buffervvuses has a positive reference count, throws if this precondition isn't met.voidclear()Release any owned ArrowBuf and reset the ValueVector to the initial state.voidclose()Alternative to clear().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.protected voidcopyValidityBuffer(int startIndex, int length, BaseValueVector target) Allocate new validity buffer for `target` and copy bytes from `validityBuffer`.Get the allocator associated with the vector.abstract StringgetName()Gets the name of the vector.Default implementation to create a reader for the vector.protected abstract FieldReaderEach vector has a different reader that implements the FieldReader interface.getTransferPair(BufferAllocator allocator) To transfer quota responsibility.protected static intgetValidityBufferSizeFromCount(int valueCount) Deprecated, for removal: This API element is subject to removal in a future version.iterator()protected ArrowBufreleaseBuffer(ArrowBuf buffer) 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`.protected voidsplitAndTransferValidityBuffer(int startIndex, int length, BaseValueVector target) Transfer the validity buffer from `validityBuffer` to the target vector's `validityBuffer`.toString()Representation of vector suitable for debugging.static ArrowBuftransferBuffer(ArrowBuf srcBuffer, BufferAllocator targetAllocator) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliteratorMethods inherited from interface org.apache.arrow.vector.ValueVector
accept, allocateNew, allocateNewSafe, getBuffers, getBufferSize, getBufferSizeFor, getDataBuffer, getField, getMinorType, getNullCount, getObject, getOffsetBuffer, getTransferPair, getTransferPair, getTransferPair, getTransferPair, getValidityBuffer, getValueCapacity, getValueCount, hashCode, hashCode, isNull, makeTransferPair, reAlloc, reset, setInitialCapacity, setValueCount, validate, validateFull
-
Field Details
-
MAX_ALLOCATION_SIZE_PROPERTY
- See Also:
-
MAX_ALLOCATION_SIZE
public static final long MAX_ALLOCATION_SIZE -
INITIAL_VALUE_ALLOCATION
public static final int INITIAL_VALUE_ALLOCATION- See Also:
-
allocator
-
fieldReader
-
validityBuffer
-
valueCount
protected int valueCount
-
-
Constructor Details
-
BaseValueVector
-
-
Method Details
-
getName
Description copied from interface:ValueVectorGets the name of the vector.- Specified by:
getNamein interfaceValueVector- Returns:
- the name of the vector.
-
toString
Representation of vector suitable for debugging. -
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
-
close
public void close()Description copied from interface:ValueVectorAlternative to clear(). Allows use as an AutoCloseable in try-with-resources.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceValueVector
-
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.
-
iterator
- Specified by:
iteratorin interfaceIterable<ValueVector>
-
checkBufRefs
Checks to ensure that every buffervvuses has a positive reference count, throws if this precondition isn't met. Returns true otherwise. -
getAllocator
Description copied from interface:ValueVectorGet the allocator associated with the vector. CAVEAT: Some ValueVector subclasses (e.g. NullVector) do not require an allocator for data storage and may return null.- Specified by:
getAllocatorin interfaceValueVector- Returns:
- Returns nullable allocator.
-
releaseBuffer
-
getValidityBufferSizeFromCount
@Deprecated(forRemoval=true, since="18.4.0") protected static int getValidityBufferSizeFromCount(int valueCount) Deprecated, for removal: This API element is subject to removal in a future version.-- useBitVectorHelper.getValidityBufferSizeFromCount(int)instead.Compute the size of validity buffer required to manage a given number of elements in a vector.- Parameters:
valueCount- number of elements in the vector- Returns:
- buffer size
-
getReaderImpl
Each vector has a different reader that implements the FieldReader interface. Overridden methods must make sure to return the correct concrete reader implementation.- Returns:
- Returns a lambda that initializes a reader when called.
-
getReader
Default implementation to create a reader for the vector. Depends on the individual vector class' implementation ofgetReaderImpl()to initialize the reader appropriately.- Specified by:
getReaderin interfaceValueVector- Returns:
- Concrete instance of FieldReader by using double-checked locking.
-
transferBuffer
-
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- 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- Parameters:
fromIndex- position to copy from in source vectorthisIndex- position to copy to in this vectorfrom- source vector
-
splitAndTransferValidityBuffer
Transfer the validity buffer from `validityBuffer` to the target vector's `validityBuffer`. Start at `startIndex` and copy `length` number of elements. If the starting index is 8 byte aligned, then the buffer is sliced from that index and ownership is transferred. If not, individual bytes are copied.- Parameters:
startIndex- starting indexlength- number of elements to be copiedtarget- target vector
-
sliceAndTransferValidityBuffer
If the start index is 8 byte aligned, slice `validityBuffer` and transfer ownership to `target`'s `validityBuffer`.- Parameters:
startIndex- starting indexlength- number of elements to be copiedtarget- target vector
-
copyValidityBuffer
Allocate new validity buffer for `target` and copy bytes from `validityBuffer`. Precise details in the comments below.- Parameters:
startIndex- starting indexlength- number of elements to be copiedtarget- target vector
-
allocateValidityBuffer
protected void allocateValidityBuffer(long byteSizeTarget) Allocate new validity buffer for when the bytes need to be copied over.- Parameters:
byteSizeTarget- desired size of the buffer
-
BitVectorHelper.getValidityBufferSizeFromCount(int)instead.