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 BufferAllocator
protected FieldReader
static final int
static final long
static final String
protected ArrowBuf
protected int
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
allocateValidityBuffer
(long byteSizeTarget) Allocate new validity buffer for when the bytes need to be copied over.static boolean
Checks to ensure that every buffervv
uses has a positive reference count, throws if this precondition isn't met.void
clear()
Release any owned ArrowBuf and reset the ValueVector to the initial state.void
close()
Alternative to clear().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 asValueVector.copyFrom(int, int, ValueVector)
except that it handles the case when the capacity of the vector needs to be expanded before copy.protected void
copyValidityBuffer
(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 String
getName()
Gets the name of the vector.Default implementation to create a reader for the vector.protected abstract FieldReader
Each vector has a different reader that implements the FieldReader interface.getTransferPair
(BufferAllocator allocator) To transfer quota responsibility.protected static int
getValidityBufferSizeFromCount
(int valueCount) Deprecated, for removal: This API element is subject to removal in a future version.iterator()
protected ArrowBuf
releaseBuffer
(ArrowBuf buffer) protected void
sliceAndTransferValidityBuffer
(int startIndex, int length, BaseValueVector target) If the start index is 8 byte aligned, slice `validityBuffer` and transfer ownership to `target`'s `validityBuffer`.protected void
splitAndTransferValidityBuffer
(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 ArrowBuf
transferBuffer
(ArrowBuf srcBuffer, BufferAllocator targetAllocator) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
Methods 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:ValueVector
Gets the name of the vector.- Specified by:
getName
in interfaceValueVector
- Returns:
- the name of the vector.
-
toString
Representation of vector suitable for debugging. -
clear
public void clear()Description copied from interface:ValueVector
Release 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:
clear
in interfaceValueVector
-
close
public void close()Description copied from interface:ValueVector
Alternative to clear(). Allows use as an AutoCloseable in try-with-resources.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfaceValueVector
-
getTransferPair
Description copied from interface:ValueVector
To transfer quota responsibility.- Specified by:
getTransferPair
in interfaceValueVector
- Parameters:
allocator
- the target allocator- Returns:
- a
transfer pair
, creating a new target vector of the same type.
-
iterator
- Specified by:
iterator
in interfaceIterable<ValueVector>
-
checkBufRefs
Checks to ensure that every buffervv
uses has a positive reference count, throws if this precondition isn't met. Returns true otherwise. -
getAllocator
Description copied from interface:ValueVector
Get 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:
getAllocator
in 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:
getReader
in interfaceValueVector
- Returns:
- Concrete instance of FieldReader by using double-checked locking.
-
transferBuffer
-
copyFrom
Description copied from interface:ValueVector
Copy a cell value from a particular index in source vector to a particular position in this vector.- Specified by:
copyFrom
in interfaceValueVector
- Parameters:
fromIndex
- position to copy from in source vectorthisIndex
- position to copy to in this vectorfrom
- source vector
-
copyFromSafe
Description copied from interface:ValueVector
Same 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:
copyFromSafe
in 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.