java.lang.Object
org.apache.arrow.vector.BaseValueVector
org.apache.arrow.vector.BaseFixedWidthVector
org.apache.arrow.vector.Float2Vector
- All Implemented Interfaces:
Closeable
,AutoCloseable
,Iterable<ValueVector>
,ElementAddressableVector
,FieldVector
,FixedWidthVector
,FloatingPointVector
,ValueIterableVector<Short>
,ValueVector
,VectorDefinitionSetter
public final class Float2Vector
extends BaseFixedWidthVector
implements FloatingPointVector, ValueIterableVector<Short>
Float2Vector implements a fixed width (2 bytes) vector of short 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, valueCount
Fields inherited from class org.apache.arrow.vector.BaseValueVector
allocator, fieldReader, INITIAL_VALUE_ALLOCATION, MAX_ALLOCATION_SIZE, MAX_ALLOCATION_SIZE_PROPERTY
-
Constructor Summary
ConstructorDescriptionFloat2Vector
(String name, BufferAllocator allocator) Instantiate a Float2Vector.Float2Vector
(String name, FieldType fieldType, BufferAllocator allocator) Instantiate a Float2Vector.Float2Vector
(Field field, BufferAllocator allocator) Instantiate a Float2Vector. -
Method Summary
Modifier and TypeMethodDescriptionshort
get
(int index) Get the element at the given index from the vector.void
get
(int index, NullableFloat2Holder holder) Get the element at the given index from the vector and sets the state in holder.Get minor type for this vector.getObject
(int index) Same asget(int)
.protected FieldReader
Each 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.double
getValueAsDouble
(int index) Gets the value at the given index.float
getValueAsFloat
(int index) Construct a TransferPair with a desired target vector of the same type.void
set
(int index, int isSet, short value) Store the given value at a particular position in the vector.void
set
(int index, short value) Set the element at the given index to the given value.void
set
(int index, Float2Holder holder) Set the element at the given index to the value set in data holder.void
set
(int index, NullableFloat2Holder holder) Set the element at the given index to the value set in data holder.void
setSafe
(int index, int isSet, short value) Same asset(int, int, short)
except that it handles the case when index is greater than or equal to current value capacity of the vector.void
setSafe
(int index, short value) Same asset(int, short)
except that it handles the case when index is greater than or equal to existing value capacityBaseFixedWidthVector.getValueCapacity()
.void
setSafe
(int index, Float2Holder holder) Same asset(int, Float2Holder)
except that it handles the case when index is greater than or equal to existing value capacityBaseFixedWidthVector.getValueCapacity()
.void
setSafe
(int index, NullableFloat2Holder holder) Same asset(int, NullableFloat2Holder)
except that it handles the case when index is greater than or equal to existing value capacityBaseFixedWidthVector.getValueCapacity()
.void
setSafeWithPossibleTruncate
(int index, double value) Sets the value at the given index, note this value may be truncated internally.void
setSafeWithPossibleTruncate
(int index, float value) Same assetWithPossibleTruncate(int, float)
except that it handles the case when index is greater than or equal to existing value capacityBaseFixedWidthVector.getValueCapacity()
.void
setSafeWithPossibleTruncate
(int index, int isSet, float value) Same asset(int, int, short)
except that it handles the case when index is greater than or equal to current value capacity of the vector.void
setWithPossibleTruncate
(int index, double value) Sets the value at the given index, note this value may be truncated internally.void
setWithPossibleTruncate
(int index, float value) Set the element at the given index to the given value.void
setWithPossibleTruncate
(int index, int isSet, float value) Store the given value at a particular position in the 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, validateScalars, zeroVector
Methods inherited from class org.apache.arrow.vector.BaseValueVector
checkBufRefs, getAllocator, getReader, getValidityBufferSizeFromCount, iterator, releaseBuffer, toString, transferBuffer
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.apache.arrow.vector.FieldVector
exportBuffer, exportCDataBuffers, getExportedCDataBufferCount
Methods inherited from interface java.lang.Iterable
forEach, iterator, spliterator
Methods inherited from interface org.apache.arrow.vector.ValueIterableVector
getValueIterable, getValueIterator
Methods 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
-
TYPE_WIDTH
public static final byte TYPE_WIDTH- See Also:
-
-
Constructor Details
-
Float2Vector
Instantiate a Float2Vector. This doesn't allocate any memory for the data in vector.- Parameters:
name
- name of the vectorallocator
- allocator for memory management.
-
Float2Vector
Instantiate a Float2Vector. 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.
-
Float2Vector
Instantiate a Float2Vector. 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:BaseValueVector
Each vector has a different reader that implements the FieldReader interface. Overridden methods must make sure to return the correct concrete reader implementation.- Specified by:
getReaderImpl
in 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:
getMinorType
in interfaceValueVector
- Returns:
Types.MinorType
-
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:
getObject
in interfaceValueVector
- Parameters:
index
- position of element- Returns:
- element at given index
-
getValueAsDouble
public double getValueAsDouble(int index) Description copied from interface:FloatingPointVector
Gets the value at the given index.- Specified by:
getValueAsDouble
in interfaceFloatingPointVector
- Parameters:
index
- the index to retrieve the value.- Returns:
- the value at the index.
-
getValueAsFloat
public float getValueAsFloat(int index) -
set
public void set(int index, short value) Set the element at the given index to the given value.- Parameters:
index
- position of elementvalue
- value of element
-
setWithPossibleTruncate
public void setWithPossibleTruncate(int index, float 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, short value) Same asset(int, short)
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
-
setSafeWithPossibleTruncate
public void setSafeWithPossibleTruncate(int index, float value) Same assetWithPossibleTruncate(int, float)
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, NullableFloat2Holder)
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, Float2Holder)
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, short 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
-
setWithPossibleTruncate
public void setWithPossibleTruncate(int index, int isSet, float 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, short value) Same asset(int, int, short)
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
-
setSafeWithPossibleTruncate
public void setSafeWithPossibleTruncate(int index, int isSet, float value) Same asset(int, int, short)
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
-
setWithPossibleTruncate
public void setWithPossibleTruncate(int index, double value) Description copied from interface:FloatingPointVector
Sets the value at the given index, note this value may be truncated internally.- Specified by:
setWithPossibleTruncate
in interfaceFloatingPointVector
- Parameters:
index
- the index to set.value
- the value to set.
-
setSafeWithPossibleTruncate
public void setSafeWithPossibleTruncate(int index, double value) Description copied from interface:FloatingPointVector
Sets the value at the given index, note this value may be truncated internally. Any expansion/reallocation is handled automatically.- Specified by:
setSafeWithPossibleTruncate
in interfaceFloatingPointVector
- Parameters:
index
- the index to set.value
- the value to set.
-
getTransferPair
Construct a TransferPair comprising this and a target vector of the same type.- Specified by:
getTransferPair
in interfaceValueVector
- Specified by:
getTransferPair
in 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:
getTransferPair
in interfaceValueVector
- Specified by:
getTransferPair
in 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:
makeTransferPair
in interfaceValueVector
- Parameters:
to
- target vector- Returns:
TransferPair
-