Class AbstractRepeatedMapVector
java.lang.Object
org.apache.drill.exec.vector.complex.AbstractContainerVector
org.apache.drill.exec.vector.complex.AbstractMapVector
org.apache.drill.exec.vector.complex.AbstractRepeatedMapVector
- All Implemented Interfaces:
Closeable
,AutoCloseable
,Iterable<ValueVector>
,ContainerVectorLike
,RepeatedValueVector
,ValueVector
- Direct Known Subclasses:
DictVector
,RepeatedMapVector
public abstract class AbstractRepeatedMapVector
extends AbstractMapVector
implements RepeatedValueVector
-
Nested Class Summary
Modifier and TypeClassDescriptionclass
class
Nested classes/interfaces inherited from interface org.apache.drill.exec.vector.complex.RepeatedValueVector
RepeatedValueVector.RepeatedAccessor, RepeatedValueVector.RepeatedMutator
-
Field Summary
Fields inherited from class org.apache.drill.exec.vector.complex.AbstractContainerVector
allocator, callBack, field
Fields inherited from interface org.apache.drill.exec.vector.complex.RepeatedValueVector
DEFAULT_REPEAT_PER_RECORD
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
ModifierConstructorDescriptionprotected
AbstractRepeatedMapVector
(MaterializedField field, BufferAllocator allocator, CallBack callBack) protected
AbstractRepeatedMapVector
(MaterializedField field, UInt4Vector offsets, CallBack callBack) -
Method Summary
Modifier and TypeMethodDescription<T extends ValueVector>
AddOrGetResult<T>addOrGetVector
(VectorDescriptor descriptor) Creates and adds a child vector if none with the same name exists, else returns the vector instance.void
allocateNew
(int groupCount, int innerValueCount) boolean
Allocates new buffers.void
allocateOffsetsNew
(int groupCount) void
clear()
Release the underlying DrillBuf and reset the ValueVector to empty.void
close()
Clears out all underlying child vectors.void
collectLedgers
(Set<AllocationManager.BufferLedger> ledgers) Add the ledgers underlying the buffers underlying the components of the vector to the set provided.void
copyEntry
(int toIndex, ValueVector from, int fromIndex) void
copyFromSafe
(int fromIndex, int thisIndex, AbstractRepeatedMapVector from) void
exchange
(ValueVector other) Exchange state with another value vector of the same type.abstract AbstractRepeatedMapVector.Accessor
Returns anaccessor
that is used to read from this vector instance.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.int
getBufferSizeFor
(int valueCount) Returns the number of bytes that is used by this vector if it holds the given number of values.Get the metadata for this field.int
getPayloadByteCount
(int valueCount) Return the number of value bytes consumed by actual data.Returns a list of scalar child vectors recursing the entire vector hierarchy.getTransferPairToSingleMap
(String reference, BufferAllocator allocator) int
Returns the maximum number of values that can be stored in this vector instance.void
load
(UserBitShared.SerializedField metadata, DrillBuf buffer) Load the data provided in the buffer.void
setInitialCapacity
(int numRecords) Set the initial record capacityvoid
toNullable
(ValueVector nullableVector) Convert a non-nullable vector to nullable by shuffling the data from one to the other.Methods inherited from class org.apache.drill.exec.vector.complex.AbstractMapVector
addOrGet, getChild, getChildByOrdinal, getChildren, getChildVectorWithOrdinal, iterator, putChild, putVector, size
Methods inherited from class org.apache.drill.exec.vector.complex.AbstractContainerVector
allocateNew, getAllocator, getChild, getChildFieldNames, getField, supportsDirectRead, typeify
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.apache.drill.exec.vector.complex.ContainerVectorLike
size
Methods inherited from interface java.lang.Iterable
forEach, iterator, spliterator
Methods inherited from interface org.apache.drill.exec.vector.complex.RepeatedValueVector
getMutator
Methods inherited from interface org.apache.drill.exec.vector.ValueVector
allocateNew, getAllocator, getField, getReader, getTransferPair, getTransferPair, makeTransferPair
-
Field Details
-
offsets
-
emptyPopulator
-
-
Constructor Details
-
AbstractRepeatedMapVector
protected AbstractRepeatedMapVector(MaterializedField field, BufferAllocator allocator, CallBack callBack) -
AbstractRepeatedMapVector
protected AbstractRepeatedMapVector(MaterializedField field, UInt4Vector offsets, CallBack callBack)
-
-
Method Details
-
getOffsetVector
- Specified by:
getOffsetVector
in interfaceRepeatedValueVector
- Returns:
- the underlying offset vector or null if none exists.
-
getDataVector
- Specified by:
getDataVector
in interfaceRepeatedValueVector
- Returns:
- the underlying data vector or null if none exists.
-
addOrGetVector
Description copied from interface:ContainerVectorLike
Creates and adds a child vector if none with the same name exists, else returns the vector instance.- Specified by:
addOrGetVector
in interfaceContainerVectorLike
- Parameters:
descriptor
- vector descriptor- Returns:
- result of operation wrapping vector corresponding to the given descriptor and whether it's newly created
-
setInitialCapacity
public void setInitialCapacity(int numRecords) Description copied from interface:ValueVector
Set the initial record capacity- Specified by:
setInitialCapacity
in interfaceValueVector
-
allocateNew
public void allocateNew(int groupCount, int innerValueCount) -
allocateOffsetsNew
public void allocateOffsetsNew(int groupCount) -
fieldNameIterator
-
getPrimitiveVectors
Description copied from class:AbstractMapVector
Returns a list of scalar child vectors recursing the entire vector hierarchy.- Overrides:
getPrimitiveVectors
in classAbstractMapVector
-
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.- Specified by:
getBufferSize
in interfaceValueVector
- Overrides:
getBufferSize
in classAbstractMapVector
-
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.- Specified by:
getAllocatedSize
in interfaceValueVector
- Overrides:
getAllocatedSize
in classAbstractMapVector
- Returns:
- allocated buffer size, in bytes
-
getBufferSizeFor
public int getBufferSizeFor(int valueCount) Description copied from interface:ValueVector
Returns 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:
getBufferSizeFor
in interfaceValueVector
- Parameters:
valueCount
- the number of values to assume this vector contains- Returns:
- the buffer size if this vector is holding valueCount values
-
close
public void close()Description copied from class:AbstractContainerVector
Clears out all underlying child vectors.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfaceValueVector
- Overrides:
close
in classAbstractMapVector
-
getTransferPairToSingleMap
-
allocateNewSafe
public boolean allocateNewSafe()Description copied from interface:ValueVector
Allocates new buffers. ValueVector implements logic to determine how much to allocate.- Specified by:
allocateNewSafe
in interfaceValueVector
- Overrides:
allocateNewSafe
in classAbstractMapVector
- Returns:
- Returns true if allocation was successful.
-
copyFromSafe
-
copyEntry
- Specified by:
copyEntry
in interfaceValueVector
-
getValueCapacity
public int getValueCapacity()Description copied from interface:ValueVector
Returns the maximum number of values that can be stored in this vector instance.- Specified by:
getValueCapacity
in interfaceValueVector
-
exchange
Description copied from interface:ValueVector
Exchange state with another value vector of the same type. Used to implement look-ahead writers.- Specified by:
exchange
in interfaceValueVector
- Overrides:
exchange
in classAbstractMapVector
-
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).- Specified by:
getBuffers
in interfaceValueVector
- Overrides:
getBuffers
in classAbstractMapVector
- 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.
-
getMetadata
Description copied from interface:ValueVector
Get the metadata for this field. Used in serialization- Specified by:
getMetadata
in interfaceValueVector
- Returns:
- FieldMetadata for this field.
-
clear
public void clear()Description copied from interface:ValueVector
Release the underlying DrillBuf and reset the ValueVector to empty.- Specified by:
clear
in interfaceValueVector
-
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.- Specified by:
collectLedgers
in interfaceValueVector
- Overrides:
collectLedgers
in classAbstractMapVector
- Parameters:
ledgers
- set of ledgers to which to add ledgers for this vector
-
toNullable
Description copied from interface:ValueVector
Convert 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:
toNullable
in interfaceValueVector
- Parameters:
nullableVector
- nullable vector of the same minor type as this vector
-
getPayloadByteCount
public int getPayloadByteCount(int valueCount) Description copied from interface:ValueVector
Return the number of value bytes consumed by actual data.- Specified by:
getPayloadByteCount
in interfaceValueVector
- Overrides:
getPayloadByteCount
in classAbstractMapVector
-
getAccessor
Description copied from interface:ValueVector
Returns anaccessor
that is used to read from this vector instance.- Specified by:
getAccessor
in interfaceRepeatedValueVector
- Specified by:
getAccessor
in interfaceValueVector
-