Class DictVector
java.lang.Object
org.apache.drill.exec.vector.complex.AbstractContainerVector
org.apache.drill.exec.vector.complex.AbstractMapVector
org.apache.drill.exec.vector.complex.AbstractRepeatedMapVector
org.apache.drill.exec.vector.complex.DictVector
- All Implemented Interfaces:
Closeable,AutoCloseable,Iterable<ValueVector>,ContainerVectorLike,RepeatedValueVector,ValueVector
A
ValueVector holding key-value pairs.
This vector is essentially a RepeatedMapVector but with constraints:
it may have 2 children only, named FIELD_KEY_NAME and FIELD_VALUE_NAME.
The FIELD_KEY_NAME can be of primitive type only and its values should not be null,
while the other, FIELD_VALUE_NAME, field can be either of primitive or complex type.
Value field can hold null values.
This vector has it's own FieldReader and
FieldWriter to ensure data is read and written correctly.
In addition, the reader is responsible for getting a value for a given key.
Additionally, Object representation is changed in DictVector.Accessor.getObject(int)
to represent it as JsonStringHashMap with appropriate key and value types.
(The structure corresponds to Java's notion of Map).
- See Also:
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface org.apache.drill.exec.vector.complex.RepeatedValueVector
RepeatedValueVector.RepeatedAccessor, RepeatedValueVector.RepeatedMutator -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringstatic final TypeProtos.MajorTypeFields inherited from class org.apache.drill.exec.vector.complex.AbstractRepeatedMapVector
emptyPopulator, offsetsFields inherited from class org.apache.drill.exec.vector.complex.AbstractContainerVector
allocator, callBack, fieldFields inherited from interface org.apache.drill.exec.vector.complex.RepeatedValueVector
DEFAULT_REPEAT_PER_RECORDFields 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
ConstructorsConstructorDescriptionDictVector(MaterializedField field, BufferAllocator allocator, CallBack callBack) DictVector(MaterializedField field, BufferAllocator allocator, CallBack callBack, TypeProtos.MajorType keyType, TypeProtos.MajorType valueType) -
Method Summary
Modifier and TypeMethodDescriptionvoidexchange(ValueVector other) Exchange state with another value vector of the same type.Returns anaccessorthat is used to read from this vector instance.Returns aValueVectorcorresponding to the given field name if exists or null.<T extends ValueVector>
TReturns aValueVectorinstance of subtype ofcorresponding to the given field name if exists or null. protected Collection<String> Returns a sequence of field names in the order that they show up in the schema.Returns a vector with its corresponding ordinal mapping if field exists or null.getKeys()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.booleanReturns a newtransfer pairthat is used to transfer underlying buffers into the target vector.voidputChild(String name, ValueVector vector) Inserts the vector with the given name if it does not exist else replaces it with the new value.voidtransferTo(DictVector target) Methods inherited from class org.apache.drill.exec.vector.complex.AbstractRepeatedMapVector
addOrGetVector, allocateNew, allocateNewSafe, allocateOffsetsNew, clear, close, collectLedgers, copyEntry, copyFromSafe, fieldNameIterator, getAllocatedSize, getBuffers, getBufferSize, getBufferSizeFor, getDataVector, getMetadata, getOffsetVector, getPayloadByteCount, getPrimitiveVectors, getTransferPairToSingleMap, getValueCapacity, load, setInitialCapacity, toNullableMethods inherited from class org.apache.drill.exec.vector.complex.AbstractMapVector
addOrGet, getChildByOrdinal, getChildren, iterator, putVector, sizeMethods inherited from class org.apache.drill.exec.vector.complex.AbstractContainerVector
allocateNew, getAllocator, getField, supportsDirectRead, typeifyMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.drill.exec.vector.complex.ContainerVectorLike
sizeMethods inherited from interface java.lang.Iterable
forEach, iterator, spliteratorMethods inherited from interface org.apache.drill.exec.vector.ValueVector
allocateNew, getAllocator, getField
-
Field Details
-
TYPE
-
FIELD_KEY_NAME
- See Also:
-
FIELD_VALUE_NAME
- See Also:
-
fieldNames
-
-
Constructor Details
-
DictVector
-
DictVector
public DictVector(MaterializedField field, BufferAllocator allocator, CallBack callBack, TypeProtos.MajorType keyType, TypeProtos.MajorType valueType)
-
-
Method Details
-
getReader
Description copied from interface:ValueVectorReturns afield readerthat supports reading values from this vector. -
getChildFieldNames
Description copied from class:AbstractContainerVectorReturns a sequence of field names in the order that they show up in the schema.- Overrides:
getChildFieldNamesin classAbstractContainerVector
-
transferTo
-
makeTransferPair
-
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
-
putChild
Inserts the vector with the given name if it does not exist else replaces it with the new value. If the vector is replaced, old and new type are expected to be equal. Validates that thenameis eitherFIELD_KEY_NAMEorFIELD_VALUE_NAMEand that key is of primitive type.- Overrides:
putChildin classAbstractMapVector- Parameters:
name- field namevector- vector to be added- Throws:
DrillRuntimeException- ifnameis not equal toFIELD_KEY_NAMEorFIELD_VALUE_NAMEor ifname.equals(FIELD_KEY_NAME)and vector is of repeated or complex type.
-
getChild
Returns aValueVectorcorresponding to the given field name if exists or null. Expects eitherFIELD_KEY_NAMEorFIELD_VALUE_NAME.- Overrides:
getChildin classAbstractContainerVector- Parameters:
name- field's name
-
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 classAbstractRepeatedMapVector
-
getChildVectorWithOrdinal
Description copied from class:AbstractMapVectorReturns a vector with its corresponding ordinal mapping if field exists or null.- Overrides:
getChildVectorWithOrdinalin classAbstractMapVector
-
getChild
Description copied from class:AbstractMapVectorReturns aValueVectorinstance of subtype ofcorresponding to the given field name if exists or null. - Overrides:
getChildin classAbstractMapVector
-
getAccessor
Description copied from interface:ValueVectorReturns anaccessorthat is used to read from this vector instance.- Specified by:
getAccessorin interfaceRepeatedValueVector- Specified by:
getAccessorin interfaceValueVector- Specified by:
getAccessorin classAbstractRepeatedMapVector
-
getMutator
Description copied from interface:ValueVectorReturns anmutatorthat is used to write to this vector instance. -
getKeys
-
getValues
-
getKeyType
-
getValueType
-
isValueNullable
public boolean isValueNullable()
-