Package org.apache.drill.exec.vector
Class IntervalVector
java.lang.Object
org.apache.drill.exec.vector.BaseValueVector
org.apache.drill.exec.vector.BaseDataValueVector
org.apache.drill.exec.vector.IntervalVector
- All Implemented Interfaces:
Closeable,AutoCloseable,Iterable<ValueVector>,FixedWidthVector,ValueVector
Interval implements a vector of fixed width values. Elements in the
vector are accessed by position, starting from the logical start of the
vector. Values should be pushed onto the vector sequentially, but may be
accessed randomly.
- The width of each element is
VALUE_WIDTH(= 16) bytes. - The equivalent Java primitive is 'DrillBuf'.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionfinal classfinal classInterval.Mutator implements a mutable vector of fixed width values.Nested classes/interfaces inherited from class org.apache.drill.exec.vector.BaseValueVector
BaseValueVector.BaseAccessor, BaseValueVector.BaseMutator -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intMaximum number of values that this fixed-width vector can hold and stay below the maximum vector size limit and/or stay below the maximum row count.static final intMaximum number of values that this fixed-width vector can hold and stay below the maximum vector size limit.static final intActual maximum vector size, in bytes, given the number of fixed-width values that either fit in the maximum overall vector size, or that is no larger than the maximum vector item count.static final intWidth of each fixed-width value.Fields inherited from class org.apache.drill.exec.vector.BaseDataValueVector
data, emptyByteArrayFields inherited from class org.apache.drill.exec.vector.BaseValueVector
allocator, field, INITIAL_VALUE_ALLOCATION, MAX_ALLOCATION_SIZEFields inherited from interface org.apache.drill.exec.vector.ValueVector
BITS_VECTOR_NAME, MAX_BUFFER_SIZE, MAX_ROW_COUNT, MIN_ROW_COUNT, OFFSETS_VECTOR_NAME, VALUES_VECTOR_NAME -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAllocate new buffers.voidallocateNew(int valueCount) Allocate a new buffer that supports setting at least the provided number of values.booleanAllocates new buffers.voidcopyEntry(int toIndex, ValueVector from, int fromIndex) voidcopyFrom(int fromIndex, int thisIndex, IntervalVector from) voidcopyFromSafe(int fromIndex, int thisIndex, IntervalVector from) voidReturns anaccessorthat is used to read from this vector instance.intgetBufferSizeFor(int valueCount) Returns the number of bytes that is used by this vector if it holds the given number of values.Returns anmutatorthat is used to write to this vector instance.intgetPayloadByteCount(int valueCount) Return the number of value bytes consumed by actual data.Returns afield readerthat supports reading values from this vector.getTransferPair(String ref, BufferAllocator allocator) getTransferPair(BufferAllocator allocator) Returns atransfer pair, creating a new target vector of the same type.intReturns the maximum number of values that can be stored in this vector instance.intThe width of a record in bytes.voidload(UserBitShared.SerializedField metadata, DrillBuf buffer) Load the data provided in the buffer.Returns a newtransfer pairthat is used to transfer underlying buffers into the target vector.voidreAlloc()Allocate new buffer with double capacity, and copy data into the new buffer.reallocRaw(int newAllocationSize) Core of vector allocation.voidreset()This method has a similar effect of allocateNew() without actually clearing and reallocating the value vector.voidsetInitialCapacity(int valueCount) Set the initial record capacityvoidsplitAndTransferTo(int startIndex, int length, IntervalVector target) voidtoNullable(ValueVector nullableVector) Convert a non-nullable vector to nullable by shuffling the data from one to the other.voidtransferTo(IntervalVector target) voidZero out the underlying buffer backing this vector.Methods inherited from class org.apache.drill.exec.vector.BaseDataValueVector
clear, close, collectLedgers, exchange, getAllocatedSize, getBuffer, getBuffers, getBufferSizeMethods inherited from class org.apache.drill.exec.vector.BaseValueVector
checkBufRefs, fillBitsVector, getAllocator, getField, getField, getMetadata, getMetadataBuilder, iterator, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, iterator, spliteratorMethods inherited from interface org.apache.drill.exec.vector.ValueVector
clear, close, collectLedgers, exchange, getAllocatedSize, getAllocator, getBuffers, getBufferSize, getField, getMetadata
-
Field Details
-
VALUE_WIDTH
public static final int VALUE_WIDTHWidth of each fixed-width value.- See Also:
-
MAX_VALUE_COUNT
public static final int MAX_VALUE_COUNTMaximum number of values that this fixed-width vector can hold and stay below the maximum vector size limit. This is the limit enforced when the vector is used to hold values in a repeated vector. -
MAX_SCALAR_COUNT
public static final int MAX_SCALAR_COUNTMaximum number of values that this fixed-width vector can hold and stay below the maximum vector size limit and/or stay below the maximum row count. This is the limit enforced when the vector is used to hold scalar (required or nullable) values.Note: MAX_ROW_COUNT is defined in the parent ValueVector class as the maximum number of rows in a record batch (64K). Use this in place of the Character.MAX_SIZE value previously used.
-
NET_MAX_SCALAR_SIZE
public static final int NET_MAX_SCALAR_SIZEActual maximum vector size, in bytes, given the number of fixed-width values that either fit in the maximum overall vector size, or that is no larger than the maximum vector item count.
-
-
Constructor Details
-
IntervalVector
-
-
Method Details
-
getReader
Description copied from interface:ValueVectorReturns afield readerthat supports reading values from this vector.- Specified by:
getReaderin interfaceValueVector
-
getBufferSizeFor
public int getBufferSizeFor(int valueCount) Description copied from interface:ValueVectorReturns the number of bytes that is used by this vector if it holds the given number of values. The result will be the same as if Mutator.setValueCount() were called, followed by calling getBufferSize(), but without any of the closing side-effects that setValueCount() implies wrt finishing off the population of a vector. Some operations might wish to use this to determine how much memory has been used by a vector so far, even though it is not finished being populated.- Specified by:
getBufferSizeForin interfaceValueVector- Parameters:
valueCount- the number of values to assume this vector contains- Returns:
- the buffer size if this vector is holding valueCount values
-
getValueCapacity
public int getValueCapacity()Description copied from interface:ValueVectorReturns the maximum number of values that can be stored in this vector instance.- Specified by:
getValueCapacityin interfaceValueVector
-
getAccessor
Description copied from interface:ValueVectorReturns anaccessorthat is used to read from this vector instance.- Specified by:
getAccessorin interfaceValueVector
-
getMutator
Description copied from interface:ValueVectorReturns anmutatorthat is used to write to this vector instance.- Specified by:
getMutatorin interfaceValueVector
-
setInitialCapacity
public void setInitialCapacity(int valueCount) Description copied from interface:ValueVectorSet the initial record capacity- Specified by:
setInitialCapacityin interfaceValueVector- Parameters:
valueCount-
-
allocateNew
public void allocateNew()Description copied from interface:ValueVectorAllocate new buffers. ValueVector implements logic to determine how much to allocate.- Specified by:
allocateNewin interfaceValueVector
-
allocateNewSafe
public boolean allocateNewSafe()Description copied from interface:ValueVectorAllocates new buffers. ValueVector implements logic to determine how much to allocate.- Specified by:
allocateNewSafein interfaceValueVector- Returns:
- Returns true if allocation was successful.
-
allocateNew
public void allocateNew(int valueCount) Allocate a new buffer that supports setting at least the provided number of values. May actually be sized bigger depending on underlying buffer rounding size. Must be called prior to using the ValueVector. Note that the maximum number of values a vector can allocate is Integer.MAX_VALUE / value width.- Specified by:
allocateNewin interfaceFixedWidthVector- Parameters:
valueCount-- Throws:
OutOfMemoryException- if it can't allocate the new buffer
-
reset
public void reset()Description copied from class:BaseDataValueVectorThis method has a similar effect of allocateNew() without actually clearing and reallocating the value vector. The purpose is to move the value vector to a "mutate" state- Overrides:
resetin classBaseDataValueVector
-
reAlloc
public void reAlloc()Allocate new buffer with double capacity, and copy data into the new buffer. Replace vector's buffer with new buffer, and release old one -
reallocRaw
Description copied from class:BaseDataValueVectorCore of vector allocation. Given a new size (which must be a power of two), allocate the new buffer, copy the current values, and leave the unused parts garbage-filled.- Specified by:
reallocRawin classBaseDataValueVector- Parameters:
newAllocationSize- new buffer size as a power of two- Returns:
- the new buffer
-
zeroVector
public void zeroVector()Zero out the underlying buffer backing this vector.- Specified by:
zeroVectorin interfaceFixedWidthVector
-
getTransferPair
Description copied from interface:ValueVectorReturns atransfer pair, creating a new target vector of the same type.- Specified by:
getTransferPairin interfaceValueVector- Overrides:
getTransferPairin classBaseValueVector
-
getTransferPair
- Specified by:
getTransferPairin interfaceValueVector
-
makeTransferPair
Description copied from interface:ValueVectorReturns a newtransfer pairthat is used to transfer underlying buffers into the target vector.- Specified by:
makeTransferPairin interfaceValueVector
-
transferTo
-
splitAndTransferTo
-
getPayloadByteCount
public int getPayloadByteCount(int valueCount) Description copied from interface:ValueVectorReturn the number of value bytes consumed by actual data.- Specified by:
getPayloadByteCountin interfaceValueVector
-
getValueWidth
public int getValueWidth()Description copied from interface:FixedWidthVectorThe width of a record in bytes.- Specified by:
getValueWidthin interfaceFixedWidthVector- Returns:
- The width of a record in bytes.
-
copyFrom
-
copyFromSafe
-
copyEntry
- Specified by:
copyEntryin interfaceValueVector
-
decrementAllocationMonitor
public void decrementAllocationMonitor() -
toNullable
Description copied from interface:ValueVectorConvert a non-nullable vector to nullable by shuffling the data from one to the other. Avoids the need to generate copy code just to change mode. If this vector is non-nullable, accepts a nullable dual (same minor type, different mode.) If the vector is non-nullable, or non-scalar, then throws an exception.- Specified by:
toNullablein interfaceValueVector- Overrides:
toNullablein classBaseValueVector- Parameters:
nullableVector- nullable vector of the same minor type as this vector
-