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 classes/interfaces inherited from class org.apache.drill.exec.vector.accessor.writer.AbstractArrayWriter
AbstractArrayWriter.ArrayElementWriterIndex, AbstractArrayWriter.ArrayObjectWriter, AbstractArrayWriter.BaseArrayWriter
Nested classes/interfaces inherited from interface org.apache.drill.exec.vector.accessor.writer.WriterEvents
WriterEvents.ColumnWriterListener, WriterEvents.State
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
static final int
Fields inherited from class org.apache.drill.exec.vector.accessor.writer.AbstractArrayWriter
elementIndex, elementObjWriter, offsetsWriter, outerIndex
-
Constructor Summary
ConstructorDescriptionObjectDictWriter
(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.void
Generic 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
save
Methods inherited from class org.apache.drill.exec.vector.accessor.writer.AbstractArrayWriter.BaseArrayWriter
bindIndex, dump, endArrayValue, endWrite, lastWriteIndex, postRollover, preRollover, restartRow, saveRow, startRow, startWrite
Methods 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, writeIndex
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.accessor.ArrayWriter
array, dict, entry, entryType, save, scalar, setNull, size, tuple, variant
Methods 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:DictWriter
Returns scalar type of the key field.- Specified by:
keyType
in interfaceDictWriter
- Returns:
- type of the key
-
valueType
Description copied from interface:DictWriter
Returns object type of the value field.- Specified by:
valueType
in interfaceDictWriter
- Returns:
- type of the value
-
keyWriter
Description copied from interface:DictWriter
Returns the writer associated with key field.- Specified by:
keyWriter
in interfaceDictWriter
- Returns:
- key writer
-
valueWriter
Description copied from interface:DictWriter
Returns the writer associated with value field.- Specified by:
valueWriter
in interfaceDictWriter
- Returns:
- value writer
-
setObject
Description copied from interface:ColumnWriter
Generic 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:
setObject
in interfaceColumnWriter
- Overrides:
setObject
in classObjectArrayWriter
- Parameters:
object
- value to write to the vector. The Java type of the object indicates the Drill storage type
-