Package org.apache.arrow.vector
Class FixedSizeBinaryVector
java.lang.Object
org.apache.arrow.vector.BaseValueVector
org.apache.arrow.vector.BaseFixedWidthVector
org.apache.arrow.vector.FixedSizeBinaryVector
- All Implemented Interfaces:
Closeable,AutoCloseable,Iterable<ValueVector>,ElementAddressableVector,FieldVector,FixedWidthVector,ValueIterableVector<byte[]>,ValueVector,VectorDefinitionSetter
public class FixedSizeBinaryVector
extends BaseFixedWidthVector
implements ValueIterableVector<byte[]>
FixedSizeBinaryVector implements a fixed width vector of binary values which could be null. A
validity buffer (bit vector) is maintained to track which elements in the vector are null.
-
Field Summary
Fields inherited from class org.apache.arrow.vector.BaseFixedWidthVector
actualValueCapacity, field, lastValueCapacity, validityBuffer, valueBuffer, valueCountFields inherited from class org.apache.arrow.vector.BaseValueVector
allocator, fieldReader, INITIAL_VALUE_ALLOCATION, MAX_ALLOCATION_SIZE, MAX_ALLOCATION_SIZE_PROPERTY -
Constructor Summary
ConstructorsConstructorDescriptionFixedSizeBinaryVector(String name, BufferAllocator allocator, int byteWidth) Instantiate a FixedSizeBinaryVector.FixedSizeBinaryVector(String name, FieldType fieldType, BufferAllocator allocator) Instantiate a FixedSizeBinaryVector.FixedSizeBinaryVector(Field field, BufferAllocator allocator) Instantiate a FixedSizeBinaryVector. -
Method Summary
Modifier and TypeMethodDescriptionbyte[]get(int index) Get the element at the given index from the vector.voidget(int index, NullableFixedSizeBinaryHolder holder) Get the element at the given index from the vector and sets the state in holder.static byte[]Given a data buffer, get the value stored at a particular position in the vector.intGet minor type for this vector.byte[]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.Construct a TransferPair with a desired target vector of the same type.voidread(int index, ReusableBuffer<?> buffer) Read the value at the given position to the given output buffer.voidset(int index, byte[] value) Sets the value at index to the provided one.voidset(int index, int isSet, byte[] value) Sets the value if isSet is positive, otherwise sets the index to null/invalid.voidSet the element at the given index to the given value.voidSet the element at the given index to the given value.voidset(int index, FixedSizeBinaryHolder holder) Set the variable length element at the specified index to the data buffer supplied in the holder.voidset(int index, NullableFixedSizeBinaryHolder holder) Set the variable length element at the specified index to the data buffer supplied in the holder.voidsetSafe(int index, byte[] value) Same asset(int, byte[])but reallocates ifindexis larger than capacity.voidsetSafe(int index, int isSet, byte[] value) voidSame asset(int, ArrowBuf)except that it handles the case when index is greater than or equal to existing value capacityBaseFixedWidthVector.getValueCapacity().voidSame asset(int, ArrowBuf)except that it handles the case when index is greater than or equal to existing value capacityBaseFixedWidthVector.getValueCapacity().voidsetSafe(int index, FixedSizeBinaryHolder holder) Same asset(int, FixedSizeBinaryHolder)except that it handles the case where index and length of new element are beyond the existing capacity of the vector.voidsetSafe(int index, NullableFixedSizeBinaryHolder holder) Same asset(int, NullableFixedSizeBinaryHolder)except that it handles the case where index and length of new element are beyond the existing capacity of the vector.voidValidate the scalar values held by this vector.Methods inherited from class org.apache.arrow.vector.BaseFixedWidthVector
accept, allocateNew, allocateNew, allocateNewSafe, clear, close, copyFrom, copyFromSafe, decrementAllocationMonitor, getBuffers, getBufferSize, getBufferSizeFor, getChildrenFromFields, getDataBuffer, getDataBufferAddress, getDataPointer, getDataPointer, getField, getFieldBuffers, getFieldInnerVectors, getName, getNullCount, getOffsetBuffer, getOffsetBufferAddress, getTransferPair, getTransferPair, getTransferPair, getTypeWidth, getValidityBuffer, getValidityBufferAddress, getValidityBufferValueCapacity, getValueBufferValueCapacity, getValueCapacity, getValueCount, handleSafe, hashCode, hashCode, incrementAllocationMonitor, initializeChildrenFromFields, isNull, isSafe, isSet, loadFieldBuffers, reAlloc, refreshValueCapacity, reset, set, set, setIndexDefined, setInitialCapacity, setNull, setSafe, setSafe, setValueCount, splitAndTransferTo, transferTo, zeroVectorMethods inherited from class org.apache.arrow.vector.BaseValueVector
checkBufRefs, getAllocator, getReader, getValidityBufferSizeFromCount, iterator, releaseBuffer, 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, copyFrom, copyFromSafe, getAllocator, getBuffers, getBufferSize, getBufferSizeFor, getDataBuffer, getField, getName, getNullCount, getOffsetBuffer, getReader, getTransferPair, getTransferPair, getTransferPair, getValidityBuffer, getValueCapacity, getValueCount, hashCode, hashCode, isNull, reAlloc, reset, setInitialCapacity, setValueCount, validate, validateFull
-
Constructor Details
-
FixedSizeBinaryVector
Instantiate a FixedSizeBinaryVector. This doesn't allocate any memory for the data in vector.- Parameters:
name- name of the vectorallocator- allocator for memory management.byteWidth- byte width of the binary values
-
FixedSizeBinaryVector
Instantiate a FixedSizeBinaryVector. 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.
-
FixedSizeBinaryVector
Instantiate a FixedSizeBinaryVector. This doesn't allocate any memory for the data in vector.- Parameters:
field- 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
-
get
public byte[] get(int index) Get the element at the given index from the vector.- Parameters:
index- position of element- Returns:
- element at given index
-
read
Read the value at the given position to the given output buffer. The caller is responsible for checking for nullity first.- Parameters:
index- position of element.buffer- the buffer to write into.
-
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 elementholder- nullable holder to carry the buffer
-
getObject
public byte[] getObject(int index) Same asget(int).- Specified by:
getObjectin interfaceValueVector- Parameters:
index- position of element- Returns:
- element at given index
-
getByteWidth
public int getByteWidth() -
set
public void set(int index, byte[] value) Sets the value at index to the provided one. -
setSafe
public void setSafe(int index, byte[] value) Same asset(int, byte[])but reallocates ifindexis larger than capacity. -
set
public void set(int index, int isSet, byte[] value) Sets the value if isSet is positive, otherwise sets the index to null/invalid. -
setSafe
public void setSafe(int index, int isSet, byte[] value) -
set
Set the element at the given index to the given value.- Parameters:
index- position of elementbuffer- ArrowBuf containing binary value.
-
setSafe
Same asset(int, ArrowBuf)except that it handles the case when index is greater than or equal to existing value capacityBaseFixedWidthVector.getValueCapacity().- Parameters:
index- position of elementbuffer- ArrowBuf containing binary value.
-
set
Set the element at the given index to the given value.- Parameters:
index- position of elementbuffer- ArrowBuf containing binary value.
-
setSafe
Same asset(int, ArrowBuf)except that it handles the case when index is greater than or equal to existing value capacityBaseFixedWidthVector.getValueCapacity().- Parameters:
index- position of elementbuffer- ArrowBuf containing binary value.
-
set
Set the variable length element at the specified index to the data buffer supplied in the holder.- Parameters:
index- position of the element to setholder- holder that carries data buffer.
-
setSafe
Same asset(int, FixedSizeBinaryHolder)except that it handles the case where index and length of new element are beyond the existing capacity of the vector.- Parameters:
index- position of the element to setholder- holder that carries data buffer.
-
set
Set the variable length element at the specified index to the data buffer supplied in the holder.- Parameters:
index- position of the element to setholder- holder that carries data buffer.
-
setSafe
Same asset(int, NullableFixedSizeBinaryHolder)except that it handles the case where index and length of new element are beyond the existing capacity of the vector.- Parameters:
index- position of the element to setholder- holder that carries data buffer.
-
get
Given a data buffer, get the value stored at a particular position in the vector.This method should not be used externally.
- Parameters:
buffer- data bufferindex- position of the element.- Returns:
- value stored at the index.
-
validateScalars
public void validateScalars()Description copied from class:BaseFixedWidthVectorValidate the scalar values held by this vector.- Overrides:
validateScalarsin classBaseFixedWidthVector
-
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
-