Class ObjectDictWriter
java.lang.Object
org.apache.drill.exec.vector.accessor.writer.AbstractArrayWriter
org.apache.drill.exec.vector.accessor.writer.AbstractArrayWriter.BaseArrayWriter
org.apache.drill.exec.vector.accessor.writer.ObjectArrayWriter
org.apache.drill.exec.vector.accessor.writer.ObjectDictWriter
- All Implemented Interfaces:
ArrayWriter,ColumnWriter,DictWriter,WriterEvents,WriterPosition
The implementation represents the writer as an array writer
with special dict entry writer as its element writer.
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class org.apache.drill.exec.vector.accessor.writer.AbstractArrayWriter
AbstractArrayWriter.ArrayElementWriterIndex, AbstractArrayWriter.ArrayObjectWriter, AbstractArrayWriter.BaseArrayWriterNested classes/interfaces inherited from interface org.apache.drill.exec.vector.accessor.writer.WriterEvents
WriterEvents.ColumnWriterListener, WriterEvents.State -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intFields inherited from class org.apache.drill.exec.vector.accessor.writer.AbstractArrayWriter
elementIndex, elementObjWriter, offsetsWriter, outerIndex -
Constructor Summary
ConstructorsConstructorDescriptionObjectDictWriter(ColumnMetadata schema, UInt4Vector offsetVector, DictEntryWriter.DictEntryObjectWriter entryObjectWriter) -
Method Summary
Modifier and TypeMethodDescriptionbuildDict(ColumnMetadata metadata, DictVector vector, List<AbstractObjectWriter> keyValueWriters) buildDictArray(ColumnMetadata metadata, RepeatedDictVector vector, List<AbstractObjectWriter> keyValueWriters) keyType()Returns scalar type of the key field.Returns the writer associated with key field.voidGeneric technique to write data as a generic Java object.Returns object type of the value field.Returns the writer associated with value field.Methods inherited from class org.apache.drill.exec.vector.accessor.writer.ObjectArrayWriter
saveMethods inherited from class org.apache.drill.exec.vector.accessor.writer.AbstractArrayWriter.BaseArrayWriter
bindIndex, dump, endArrayValue, endWrite, lastWriteIndex, postRollover, preRollover, restartRow, saveRow, startRow, startWriteMethods inherited from class org.apache.drill.exec.vector.accessor.writer.AbstractArrayWriter
array, bindListener, copy, dict, entry, entryType, isProjected, nullable, offsetWriter, rowStartIndex, scalar, schema, setNull, setNull, size, tuple, type, variant, writeIndexMethods 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.accessor.ArrayWriter
array, dict, entry, entryType, save, scalar, setNull, size, tuple, variantMethods inherited from interface org.apache.drill.exec.vector.accessor.ColumnWriter
copy, isProjected, nullable, schema, setNull, type
-
Field Details
-
FIELD_KEY_ORDINAL
public static final int FIELD_KEY_ORDINAL- See Also:
-
FIELD_VALUE_ORDINAL
public static final int FIELD_VALUE_ORDINAL- See Also:
-
-
Constructor Details
-
ObjectDictWriter
public ObjectDictWriter(ColumnMetadata schema, UInt4Vector offsetVector, DictEntryWriter.DictEntryObjectWriter entryObjectWriter)
-
-
Method Details
-
buildDict
public static ObjectDictWriter.DictObjectWriter buildDict(ColumnMetadata metadata, DictVector vector, List<AbstractObjectWriter> keyValueWriters) -
buildDictArray
public static AbstractArrayWriter.ArrayObjectWriter buildDictArray(ColumnMetadata metadata, RepeatedDictVector vector, List<AbstractObjectWriter> keyValueWriters) -
keyType
Description copied from interface:DictWriterReturns scalar type of the key field.- Specified by:
keyTypein interfaceDictWriter- Returns:
- type of the key
-
valueType
Description copied from interface:DictWriterReturns object type of the value field.- Specified by:
valueTypein interfaceDictWriter- Returns:
- type of the value
-
keyWriter
Description copied from interface:DictWriterReturns the writer associated with key field.- Specified by:
keyWriterin interfaceDictWriter- Returns:
- key writer
-
valueWriter
Description copied from interface:DictWriterReturns the writer associated with value field.- Specified by:
valueWriterin interfaceDictWriter- Returns:
- value writer
-
setObject
Description copied from interface:ColumnWriterGeneric technique to write data as a generic Java object. The type of the object must match the target writer. Primarily for testing.- Scalar: The type of the Java object must match the type of the target vector. String or byte[] can be used for Varchar vectors.
- Array: Write the array given an array of values. The object must be a Java array. The type of the array must match the type of element in the repeated vector. That is, if the vector is a Repeated Int, provide an int[] array.
- Tuple (map or row): The Java object must be an array of objects in which the members of the array have a 1:1 correspondence with the members of the tuple in the order defined by the writer metadata. That is, if the map is (Int, Varchar), provide a Object[] array like this: {10, "fred"}.
- Union: Uses the Java object type to determine the type of the backing vector. Creates a vector of the required type if needed.
- Specified by:
setObjectin interfaceColumnWriter- Overrides:
setObjectin classObjectArrayWriter- Parameters:
object- value to write to the vector. The Java type of the object indicates the Drill storage type
-