java.lang.Object
org.apache.arrow.vector.BaseValueVector
org.apache.arrow.vector.BaseFixedWidthVector
org.apache.arrow.vector.UInt1Vector
- All Implemented Interfaces:
Closeable,AutoCloseable,Iterable<ValueVector>,BaseIntVector,ElementAddressableVector,FieldVector,FixedWidthVector,ValueIterableVector<Byte>,ValueVector,VectorDefinitionSetter
public final class UInt1Vector
extends BaseFixedWidthVector
implements BaseIntVector, ValueIterableVector<Byte>
UInt1Vector implements a fixed width (1 bytes) vector of integer values which could be null. A
validity buffer (bit vector) is maintained to track which elements in the vector are null.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final byteThe maximum 8-bit unsigned integer.static final intThe mask to use when promoting the unsigned byte value to an integer.static final byteFields 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
ConstructorsConstructorDescriptionUInt1Vector(String name, BufferAllocator allocator) UInt1Vector(String name, FieldType fieldType, BufferAllocator allocator) UInt1Vector(Field field, BufferAllocator allocator) Constructor for UInt1Vector. -
Method Summary
Modifier and TypeMethodDescriptionbyteget(int index) Get the element at the given index from the vector.voidget(int index, NullableUInt1Holder holder) Get the element at the given index from the vector and sets the state in holder.static shortgetNoOverflow(ArrowBuf buffer, int index) Given a data buffer, get the value stored at a particular position in the vector.getObject(int index) Same asget(int).getObjectNoOverflow(int index) Returns the value stored at index without the potential for overflow.protected FieldReaderEach vector has a different reader that implements the FieldReader interface.getTransferPair(String ref, BufferAllocator allocator) Construct a transfer pair of this vector and another vector of same type.getTransferPair(Field field, BufferAllocator allocator) Construct a TransferPair comprising this and a target vector of the same type.longgetValueAsLong(int index) Gets the value at index.Makes a new transfer pair used to transfer underlying buffers.voidset(int index, byte value) Set the element at the given index to the given value.voidset(int index, int value) Set the element at the given index to the given value.voidset(int index, int isSet, byte value) Sets the value at index to value isSet > 0, otherwise sets the index position to invalid/null.voidset(int index, NullableUInt1Holder holder) Set the element at the given index to the value set in data holder.voidset(int index, UInt1Holder holder) Set the element at the given index to the value set in data holder.voidsetSafe(int index, byte value) Same asset(int, byte)except that it handles the case when index is greater than or equal to existing value capacityBaseFixedWidthVector.getValueCapacity().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, byte value) Same asset(int, int, byte)but will reallocate the buffer if index is larger than current capacity.voidsetSafe(int index, NullableUInt1Holder holder) Same asset(int, NullableUInt1Holder)except that it handles the case when index is greater than or equal to existing value capacityBaseFixedWidthVector.getValueCapacity().voidsetSafe(int index, UInt1Holder holder) Same asset(int, UInt1Holder)except that it handles the case when index is greater than or equal to existing value capacityBaseFixedWidthVector.getValueCapacity().voidsetUnsafeWithPossibleTruncate(int index, long value) Sets the value at index, note this value may need to be truncated.voidsetWithPossibleTruncate(int index, long value) Sets the value at index, note this value may need to be truncated.toString()Representation of vector suitable for debugging.Methods inherited from class org.apache.arrow.vector.BaseFixedWidthVector
accept, allocateNew, allocateNew, allocateNewSafe, allocateValidityBuffer, 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, sliceAndTransferValidityBuffer, splitAndTransferTo, transferTo, validateScalars, zeroVectorMethods inherited from class org.apache.arrow.vector.BaseValueVector
checkBufRefs, copyValidityBuffer, getAllocator, getReader, getValidityBufferSizeFromCount, iterator, releaseBuffer, splitAndTransferValidityBuffer, 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, getChildrenFromFields, getDataBufferAddress, getExportedCDataBufferCount, getFieldBuffers, getFieldInnerVectors, getOffsetBufferAddress, getValidityBufferAddress, initializeChildrenFromFields, loadFieldBuffers, setNullMethods 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
-
Field Details
-
PROMOTION_MASK
public static final int PROMOTION_MASKThe mask to use when promoting the unsigned byte value to an integer.- See Also:
-
MAX_UINT1
public static final byte MAX_UINT1The maximum 8-bit unsigned integer.- See Also:
-
TYPE_WIDTH
public static final byte TYPE_WIDTH- See Also:
-
-
Constructor Details
-
UInt1Vector
-
UInt1Vector
-
UInt1Vector
Constructor for UInt1Vector.- Parameters:
field- Field typeallocator- Allocator type
-
-
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
- Specified by:
getMinorTypein interfaceValueVector
-
getNoOverflow
Given a data buffer, get the value stored at a particular position in the vector.To avoid overflow, the returned type is one step up from the signed type.
This method is mainly meant for integration tests.
- Parameters:
buffer- data bufferindex- position of the element.- Returns:
- value stored at the index.
-
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
-
getObjectNoOverflow
Returns the value stored at index without the potential for overflow.- Parameters:
index- position of element- Returns:
- element at given index
-
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
public void set(int index, byte 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
public void setSafe(int index, byte value) Same asset(int, byte)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, NullableUInt1Holder)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, UInt1Holder)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, byte value) Sets the value at index to value isSet > 0, otherwise sets the index position to invalid/null. -
setSafe
public void setSafe(int index, int isSet, byte value) Same asset(int, int, byte)but will reallocate the buffer if index is larger than current capacity. -
getTransferPair
Description copied from class:BaseFixedWidthVectorConstruct a transfer pair of this vector and another vector of 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
Description copied from interface:ValueVectorMakes a new transfer pair used to transfer underlying buffers.- Specified by:
makeTransferPairin interfaceValueVector- Parameters:
to- the target for the transfer- Returns:
- a new
transfer pairthat is used to transfer underlying buffers into the target vector.
-
setWithPossibleTruncate
public void setWithPossibleTruncate(int index, long value) Description copied from interface:BaseIntVectorSets the value at index, note this value may need to be truncated. Note this is safe version (i.e. call setSafe(int, ...) method in vector)- Specified by:
setWithPossibleTruncatein interfaceBaseIntVector
-
setUnsafeWithPossibleTruncate
public void setUnsafeWithPossibleTruncate(int index, long value) Description copied from interface:BaseIntVectorSets the value at index, note this value may need to be truncated. Note this is unsafe version (i.e. call set(int, ...) method in vector)- Specified by:
setUnsafeWithPossibleTruncatein interfaceBaseIntVector
-
getValueAsLong
public long getValueAsLong(int index) Description copied from interface:BaseIntVectorGets the value at index. This value may have been extended to long and will throwNullPointerExceptionif the value is null. Note null check could be turned off viaNullCheckingForGet.- Specified by:
getValueAsLongin interfaceBaseIntVector
-
toString
Description copied from class:BaseValueVectorRepresentation of vector suitable for debugging.- Overrides:
toStringin classBaseValueVector
-