Class MapVector
java.lang.Object
org.apache.drill.exec.vector.complex.AbstractContainerVector
org.apache.drill.exec.vector.complex.AbstractMapVector
org.apache.drill.exec.vector.complex.MapVector
- All Implemented Interfaces:
Closeable,AutoCloseable,Iterable<ValueVector>,ValueVector
- Direct Known Subclasses:
VectorAccessibleComplexWriter
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassprotected static classclass -
Field Summary
FieldsFields inherited from class org.apache.drill.exec.vector.complex.AbstractContainerVector
allocator, callBack, fieldFields 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
ConstructorsConstructorDescriptionMapVector(String path, BufferAllocator allocator, CallBack callBack) MapVector(MaterializedField field, BufferAllocator allocator, CallBack callBack) -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Release the underlying DrillBuf and reset the ValueVector to empty.voidclose()Clears out all underlying child vectors.voidcopyEntry(int toIndex, ValueVector from, int fromIndex) voidcopyFromSafe(int fromIndex, int thisIndex, MapVector from) voidcopyFromSafe(int fromSubIndex, int thisIndex, RepeatedMapVector from) voidexchange(ValueVector other) Exchange state with another value vector of the same type.Returns anaccessorthat is used to read from this vector instance.intReturns the total size of buffers allocated by this vector.DrillBuf[]getBuffers(boolean clear) Return the underlying buffers associated with this vector.intReturns the number of bytes that is used by 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.Get the metadata for this field.Returns anmutatorthat is used to write to this vector instance.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.getVectorById(int id) voidload(UserBitShared.SerializedField metadata, DrillBuf buf) Load the data provided in the buffer.Returns a newtransfer pairthat is used to transfer underlying buffers into the target vector.voidsetInitialCapacity(int numRecords) Set the initial record capacityvoidsetMapValueCount(int valueCount) Set the value count for the map without setting the counts for the contained vectors.protected booleanvoidtoNullable(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, allocateNewSafe, collectLedgers, getChild, getChildByOrdinal, getChildren, getChildVectorWithOrdinal, getPayloadByteCount, getPrimitiveVectors, iterator, putChild, putVector, sizeMethods inherited from class org.apache.drill.exec.vector.complex.AbstractContainerVector
allocateNew, getAllocator, getChild, getChildFieldNames, getField, typeifyMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
TYPE
-
-
Constructor Details
-
MapVector
-
MapVector
-
-
Method Details
-
getReader
Description copied from interface:ValueVectorReturns afield readerthat supports reading values from this vector. -
copyFromSafe
-
copyFromSafe
-
copyEntry
-
supportsDirectRead
protected boolean supportsDirectRead()- Overrides:
supportsDirectReadin classAbstractContainerVector
-
fieldNameIterator
-
setInitialCapacity
public void setInitialCapacity(int numRecords) Description copied from interface:ValueVectorSet the initial record capacity- Parameters:
numRecords-
-
getBufferSize
public int getBufferSize()Description copied from interface:ValueVectorReturns 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:
getBufferSizein interfaceValueVector- Overrides:
getBufferSizein classAbstractMapVector
-
getAllocatedSize
public int getAllocatedSize()Description copied from interface:ValueVectorReturns 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:
getAllocatedSizein interfaceValueVector- Overrides:
getAllocatedSizein classAbstractMapVector- Returns:
- allocated buffer size, in bytes
-
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.- Parameters:
valueCount- the number of values to assume this vector contains- Returns:
- the buffer size if this vector is holding valueCount values
-
getBuffers
Description copied from interface:ValueVectorReturn 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:
getBuffersin interfaceValueVector- Overrides:
getBuffersin 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
buffersthat is used by this vector instance.
-
getTransferPair
Description copied from interface:ValueVectorReturns atransfer pair, creating a new target vector of the same type. -
makeTransferPair
Description copied from interface:ValueVectorReturns a newtransfer pairthat is used to transfer underlying buffers into the target vector. -
getTransferPair
-
getValueCapacity
public int getValueCapacity()Description copied from interface:ValueVectorReturns the maximum number of values that can be stored in this vector instance. -
getAccessor
Description copied from interface:ValueVectorReturns anaccessorthat is used to read from this vector instance. -
getMetadata
Description copied from interface:ValueVectorGet the metadata for this field. Used in serialization- Returns:
- FieldMetadata for this field.
-
getMutator
Description copied from interface:ValueVectorReturns anmutatorthat is used to write to this vector instance. -
getVectorById
-
setMapValueCount
public void setMapValueCount(int valueCount) Set the value count for the map without setting the counts for the contained vectors. Use this only when the values of the contained vectors are set elsewhere in the code.- Parameters:
valueCount- number of items in the map
-
clear
public void clear()Description copied from interface:ValueVectorRelease the underlying DrillBuf and reset the ValueVector to empty. -
close
public void close()Description copied from class:AbstractContainerVectorClears out all underlying child vectors.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceValueVector- Overrides:
closein classAbstractMapVector
-
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.- Parameters:
nullableVector- nullable vector of the same minor type as this vector
-
exchange
Description copied from interface:ValueVectorExchange state with another value vector of the same type. Used to implement look-ahead writers.- Specified by:
exchangein interfaceValueVector- Overrides:
exchangein classAbstractMapVector
-