java.lang.Object
org.apache.arrow.vector.BaseValueVector
org.apache.arrow.vector.BaseFixedWidthVector
org.apache.arrow.vector.BitVector
- All Implemented Interfaces:
Closeable,AutoCloseable,Iterable<ValueVector>,ElementAddressableVector,FieldVector,FixedWidthVector,ValueIterableVector<Boolean>,ValueVector,VectorDefinitionSetter
BitVector implements a fixed width (1 bit) vector of boolean values which could be null. Each
value in the vector corresponds to a single bit in the underlying data stream backing the vector.
-
Field Summary
Fields inherited from class org.apache.arrow.vector.BaseFixedWidthVector
actualValueCapacity, field, lastValueCapacity, valueBufferFields inherited from class org.apache.arrow.vector.BaseValueVector
allocator, fieldReader, INITIAL_VALUE_ALLOCATION, MAX_ALLOCATION_SIZE, MAX_ALLOCATION_SIZE_PROPERTY, validityBuffer, valueCount -
Constructor Summary
ConstructorsConstructorDescriptionBitVector(String name, BufferAllocator allocator) Instantiate a BitVector.BitVector(String name, FieldType fieldType, BufferAllocator allocator) Instantiate a BitVector.BitVector(Field field, BufferAllocator allocator) Instantiate a BitVector. -
Method Summary
Modifier and TypeMethodDescriptionvoidcopyFrom(int fromIndex, int thisIndex, ValueVector from) Copy a cell value from a particular index in source vector to a particular position in this vector.intget(int index) Get the element at the given index from the vector.voidget(int index, NullableBitHolder holder) Get the element at the given index from the vector and sets the state in holder.intGet the size (number of bytes) of underlying buffers used by this vector.intgetBufferSizeFor(int count) Get the potential buffer size for a particular number of records.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.Get minor type for this vector.getObject(int index) Same asget(int).protected FieldReaderEach vector has a different reader that implements the FieldReader interface.getTransferPair(String ref, BufferAllocator allocator) Construct a TransferPair comprising this and a target vector of the same type.getTransferPair(Field field, BufferAllocator allocator) Construct a TransferPair comprising this and a target vector of the same type.protected intinthashCode(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.Construct a TransferPair with a desired target vector of the same type.voidset(int index, int value) Set the element at the given index to the given value.voidset(int index, int isSet, int value) Store the given value at a particular position in the vector. isSet indicates whether the value is NULL or not.voidSet the element at the given index to the value set in data holder.voidset(int index, NullableBitHolder holder) Set the element at the given index to the value set in data holder.voidsetInitialCapacity(int valueCount) Sets the desired value capacity for the vector.voidsetRangeToOne(int firstBitIndex, int count) Set count bits to 1 in data starting at firstBitIndex.voidsetSafe(int index, int value) Same asset(int, int)except that it handles the case when index is greater than or equal to existing value capacityBaseFixedWidthVector.getValueCapacity().voidsetSafe(int index, int isSet, int value) Same asset(int, int, int)except that it handles the case when index is greater than or equal to current value capacity of the vector.voidSame asset(int, BitHolder)except that it handles the case when index is greater than or equal to existing value capacityBaseFixedWidthVector.getValueCapacity().voidsetSafe(int index, NullableBitHolder holder) Same asset(int, NullableBitHolder)except that it handles the case when index is greater than or equal to existing value capacityBaseFixedWidthVector.getValueCapacity().voidsetSafeToOne(int index) Same assetToOne(int)except that it handles the case when index is greater than or equal to current value capacity of the vector.voidsetToOne(int index) Set the element at the given index to one.voidsplitAndTransferTo(int startIndex, int length, BaseFixedWidthVector target) Slice this vector at desired index and length and transfer the corresponding data to the target vector.Methods inherited from class org.apache.arrow.vector.BaseFixedWidthVector
accept, allocateNew, allocateNew, allocateNewSafe, allocateValidityBuffer, clear, close, copyFromSafe, decrementAllocationMonitor, getBuffers, getChildrenFromFields, getDataBuffer, getDataBufferAddress, getField, getFieldBuffers, getFieldInnerVectors, getName, getNullCount, getOffsetBuffer, getOffsetBufferAddress, getTransferPair, getTransferPair, getTransferPair, getTypeWidth, getValidityBuffer, getValidityBufferAddress, getValidityBufferValueCapacity, getValueCapacity, getValueCount, handleSafe, incrementAllocationMonitor, initializeChildrenFromFields, isNull, isSafe, isSet, loadFieldBuffers, reAlloc, refreshValueCapacity, reset, set, set, setIndexDefined, setNull, setSafe, setSafe, setValueCount, sliceAndTransferValidityBuffer, transferTo, validateScalars, zeroVectorMethods inherited from class org.apache.arrow.vector.BaseValueVector
checkBufRefs, copyValidityBuffer, getAllocator, getReader, 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, exportCDataBuffers, getExportedCDataBufferCountMethods 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
accept, allocateNew, allocateNewSafe, clear, close, copyFromSafe, getAllocator, getBuffers, getDataBuffer, getField, getName, getNullCount, getOffsetBuffer, getReader, getTransferPair, getTransferPair, getTransferPair, getValidityBuffer, getValueCapacity, getValueCount, isNull, reAlloc, reset, setValueCount, validate, validateFull
-
Constructor Details
-
BitVector
Instantiate a BitVector. This doesn't allocate any memory for the data in vector.- Parameters:
name- name of the vectorallocator- allocator for memory management.
-
BitVector
Instantiate a BitVector. This doesn't allocate any memory for the data in vector.- Parameters:
name- name of the vectorfieldType- type of Field materialized by this vectorallocator- allocator for memory management.
-
BitVector
Instantiate a BitVector. This doesn't allocate any memory for the data in vector.- Parameters:
field- the Field materialized by this vectorallocator- allocator for memory management.
-
-
Method Details
-
getReaderImpl
Description copied from class:BaseValueVectorEach vector has a different reader that implements the FieldReader interface. Overridden methods must make sure to return the correct concrete reader implementation.- Specified by:
getReaderImplin classBaseValueVector- Returns:
- Returns a lambda that initializes a reader when called.
-
getMinorType
Get minor type for this vector. The vector holds values belonging to a particular type.- Specified by:
getMinorTypein interfaceValueVector- Returns:
Types.MinorType
-
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- Overrides:
setInitialCapacityin classBaseFixedWidthVector- Parameters:
valueCount- desired number of elements in the vector
-
getValueBufferValueCapacity
protected int getValueBufferValueCapacity()- Overrides:
getValueBufferValueCapacityin classBaseFixedWidthVector
-
getBufferSizeFor
public int getBufferSizeFor(int count) Get the potential buffer size for a particular number of records.- Specified by:
getBufferSizeForin interfaceValueVector- Overrides:
getBufferSizeForin classBaseFixedWidthVector- Parameters:
count- desired number of elements in the vector- Returns:
- estimated size of underlying buffers if the vector holds a given number of elements
-
getBufferSize
public int getBufferSize()Get the size (number of bytes) of underlying buffers used by this vector.- Specified by:
getBufferSizein interfaceValueVector- Overrides:
getBufferSizein classBaseFixedWidthVector- Returns:
- size of underlying buffers.
-
splitAndTransferTo
Slice this vector at desired index and length and transfer the corresponding data to the target vector.- Overrides:
splitAndTransferToin classBaseFixedWidthVector- Parameters:
startIndex- start position of the split in source vector.length- length of the split.target- destination vector
-
get
Get the element at the given index from the vector.- Parameters:
index- position of element- Returns:
- element at given index
- Throws:
IllegalStateException
-
get
Get the element at the given index from the vector and sets the state in holder. If element at given index is null, holder.isSet will be zero.- Parameters:
index- position of element
-
getObject
Same asget(int).- Specified by:
getObjectin interfaceValueVector- Parameters:
index- position of element- Returns:
- element at given index
-
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 classBaseFixedWidthVector- Parameters:
fromIndex- position to copy from in source vectorthisIndex- position to copy to in this vectorfrom- source vector
-
set
public void set(int index, int value) Set the element at the given index to the given value.- Parameters:
index- position of elementvalue- value of element
-
set
Set the element at the given index to the value set in data holder. If the value in holder is not indicated as set, element in the at the given index will be null.- Parameters:
index- position of elementholder- nullable data holder for value of element- Throws:
IllegalArgumentException
-
set
Set the element at the given index to the value set in data holder.- Parameters:
index- position of elementholder- data holder for value of element
-
setSafe
public void setSafe(int index, int value) Same asset(int, int)except that it handles the case when index is greater than or equal to existing value capacityBaseFixedWidthVector.getValueCapacity().- Parameters:
index- position of elementvalue- value of element
-
setSafe
Same asset(int, NullableBitHolder)except that it handles the case when index is greater than or equal to existing value capacityBaseFixedWidthVector.getValueCapacity().- Parameters:
index- position of elementholder- nullable data holder for value of element- Throws:
IllegalArgumentException
-
setSafe
Same asset(int, BitHolder)except that it handles the case when index is greater than or equal to existing value capacityBaseFixedWidthVector.getValueCapacity().- Parameters:
index- position of elementholder- data holder for value of element
-
set
public void set(int index, int isSet, int value) 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 otherwisevalue- element value
-
setSafe
public void setSafe(int index, int isSet, int value) Same asset(int, int, int)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 otherwisevalue- element value
-
setToOne
public void setToOne(int index) Set the element at the given index to one.- Parameters:
index- position of element
-
setSafeToOne
public void setSafeToOne(int index) Same assetToOne(int)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 element
-
getDataPointer
Description copied from interface:ElementAddressableVectorGets the pointer for the data at the given index.- Specified by:
getDataPointerin interfaceElementAddressableVector- Overrides:
getDataPointerin classBaseFixedWidthVector- 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- Overrides:
getDataPointerin classBaseFixedWidthVector- 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- Overrides:
hashCodein classBaseFixedWidthVector
-
hashCode
Description copied from interface:ValueVectorReturns hashCode of element in index with the given hasher.- Specified by:
hashCodein interfaceValueVector- Overrides:
hashCodein classBaseFixedWidthVector
-
setRangeToOne
public void setRangeToOne(int firstBitIndex, int count) Set count bits to 1 in data starting at firstBitIndex.- Parameters:
firstBitIndex- the index of the first bit to setcount- the number of bits to set
-
getTransferPair
Construct a TransferPair comprising this and a target vector of the same type.- Specified by:
getTransferPairin interfaceValueVector- Specified by:
getTransferPairin classBaseFixedWidthVector- Parameters:
ref- name of the target vectorallocator- allocator for the target vector- Returns:
TransferPair
-
getTransferPair
Construct a TransferPair comprising this and a target vector of the same type.- Specified by:
getTransferPairin interfaceValueVector- Specified by:
getTransferPairin classBaseFixedWidthVector- Parameters:
field- Field object used by the target vectorallocator- allocator for the target vector- Returns:
TransferPair
-
makeTransferPair
Construct a TransferPair with a desired target vector of the same type.- Specified by:
makeTransferPairin interfaceValueVector- Parameters:
to- target vector- Returns:
TransferPair
-