Package org.apache.drill.exec.vector
Class BaseDataValueVector
java.lang.Object
org.apache.drill.exec.vector.BaseValueVector
org.apache.drill.exec.vector.BaseDataValueVector
- All Implemented Interfaces:
Closeable
,AutoCloseable
,Iterable<ValueVector>
,ValueVector
- Direct Known Subclasses:
BigIntVector
,BitVector
,DateVector
,Decimal18Vector
,Decimal28DenseVector
,Decimal28SparseVector
,Decimal38DenseVector
,Decimal38SparseVector
,Decimal9Vector
,Float4Vector
,Float8Vector
,IntervalDayVector
,IntervalVector
,IntervalYearVector
,IntVector
,NullableBigIntVector
,NullableBitVector
,NullableDateVector
,NullableDecimal18Vector
,NullableDecimal28DenseVector
,NullableDecimal28SparseVector
,NullableDecimal38DenseVector
,NullableDecimal38SparseVector
,NullableDecimal9Vector
,NullableFloat4Vector
,NullableFloat8Vector
,NullableIntervalDayVector
,NullableIntervalVector
,NullableIntervalYearVector
,NullableIntVector
,NullableSmallIntVector
,NullableTimeStampVector
,NullableTimeVector
,NullableTinyIntVector
,NullableUInt1Vector
,NullableUInt2Vector
,NullableUInt4Vector
,NullableUInt8Vector
,NullableVar16CharVector
,NullableVarBinaryVector
,NullableVarCharVector
,NullableVarDecimalVector
,SmallIntVector
,TimeStampVector
,TimeVector
,TinyIntVector
,UInt1Vector
,UInt2Vector
,UInt4Vector
,UInt8Vector
,UntypedNullVector
,Var16CharVector
,VarBinaryVector
,VarCharVector
,VarDecimalVector
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.drill.exec.vector.BaseValueVector
BaseValueVector.BaseAccessor, BaseValueVector.BaseMutator
Nested classes/interfaces inherited from interface org.apache.drill.exec.vector.ValueVector
ValueVector.Accessor, ValueVector.Mutator
-
Field Summary
Fields inherited from class org.apache.drill.exec.vector.BaseValueVector
allocator, field, INITIAL_VALUE_ALLOCATION, MAX_ALLOCATION_SIZE
Fields 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
-
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
Release the underlying DrillBuf and reset the ValueVector to empty.void
close()
Alternative to clear().void
collectLedgers
(Set<AllocationManager.BufferLedger> ledgers) Add the ledgers underlying the buffers underlying the components of the vector to the set provided.void
exchange
(ValueVector other) Exchange state with another value vector of the same type.int
Returns the total size of buffers allocated by this vector.DrillBuf[]
getBuffers
(boolean clear) Return the underlying buffers associated with this vector.int
Returns the number of bytes that is used by this vector instance.abstract DrillBuf
reallocRaw
(int newAllocationSize) Core of vector allocation.void
reset()
This method has a similar effect of allocateNew() without actually clearing and reallocating the value vector.Methods inherited from class org.apache.drill.exec.vector.BaseValueVector
checkBufRefs, fillBitsVector, getAllocator, getField, getField, getMetadata, getMetadataBuilder, getTransferPair, iterator, toNullable, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
Methods inherited from interface org.apache.drill.exec.vector.ValueVector
allocateNew, allocateNewSafe, copyEntry, getAccessor, getBufferSizeFor, getMutator, getPayloadByteCount, getReader, getTransferPair, getValueCapacity, load, makeTransferPair, setInitialCapacity
-
Field Details
-
emptyByteArray
protected static final byte[] emptyByteArray -
data
-
-
Constructor Details
-
BaseDataValueVector
-
-
Method Details
-
reallocRaw
Core 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.- Parameters:
newAllocationSize
- new buffer size as a power of two- Returns:
- the new buffer
-
clear
public void clear()Description copied from interface:ValueVector
Release the underlying DrillBuf and reset the ValueVector to empty.- Specified by:
clear
in interfaceValueVector
- Overrides:
clear
in classBaseValueVector
-
close
public void close()Description copied from interface:ValueVector
Alternative to clear(). Allows use as an AutoCloseable in try-with-resources.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfaceValueVector
- Overrides:
close
in classBaseValueVector
-
getBuffers
Description copied from interface:ValueVector
Return the underlying buffers associated with this vector. Note that this doesn't impact the reference counts for this buffer so it only should be used for in-context access. Also note that this buffer changes regularly thus external classes shouldn't hold a reference to it (unless they change it).- Parameters:
clear
- Whether to clear vector before returning; the buffers will still be refcounted; but the returned array will be the only reference to them- Returns:
- The underlying
buffers
that is used by this vector instance.
-
getBufferSize
public int getBufferSize()Description copied from interface:ValueVector
Returns the number of bytes that is used by this vector instance. This is a bit of a misnomer. Returns the number of bytes used by data in this instance. -
getAllocatedSize
public int getAllocatedSize()Description copied from interface:ValueVector
Returns the total size of buffers allocated by this vector. Has meaning only when vectors are directly allocated and each vector has its own buffer. Does not have meaning for vectors deserialized from the network or disk in which multiple vectors share the same vector.- Returns:
- allocated buffer size, in bytes
-
getBuffer
-
reset
public void reset()This 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 -
exchange
Description copied from interface:ValueVector
Exchange state with another value vector of the same type. Used to implement look-ahead writers. -
collectLedgers
Description copied from interface:ValueVector
Add the ledgers underlying the buffers underlying the components of the vector to the set provided. Used to determine actual memory allocation.- Parameters:
ledgers
- set of ledgers to which to add ledgers for this vector
-