Class ListWriterImpl
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.ListWriterImpl
- All Implemented Interfaces:
ArrayWriter
,ColumnWriter
,WriterEvents
,WriterPosition
List writer, which is basically an array writer, with the addition
that each list element can be null. Lists never auto-increment
their indexes since the contents of lists can change dynamically,
and auto-increment is meaningful only for scalar arrays.
-
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
Fields inherited from class org.apache.drill.exec.vector.accessor.writer.AbstractArrayWriter
elementIndex, elementObjWriter, offsetsWriter, outerIndex
-
Constructor Summary
ConstructorDescriptionListWriterImpl
(ColumnMetadata schema, ListVector vector, AbstractObjectWriter memberWriter) -
Method Summary
Modifier and TypeMethodDescriptionvoid
bindIndex
(ColumnWriterIndex index) Bind the writer to a writer index.void
End a value.void
endWrite()
End a batch: finalize any vector values.void
The vectors backing this writer rolled over.void
The vectors backing this vector are about to roll over.void
During a writer to a row, rewind the the current index position to restart the row.void
saveRow()
Saves a row.void
setNull
(boolean isNull) void
Generic technique to write data as a generic Java object.void
startRow()
Start a new row.void
Start a write (batch) operation.vector()
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
dump, lastWriteIndex
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, size, tuple, type, variant, writeIndex
-
Constructor Details
-
ListWriterImpl
-
-
Method Details
-
bindIndex
Description copied from interface:WriterEvents
Bind the writer to a writer index.- Specified by:
bindIndex
in interfaceWriterEvents
- Overrides:
bindIndex
in classAbstractArrayWriter.BaseArrayWriter
- Parameters:
index
- the writer index (top level or nested for arrays)
-
vector
-
setNull
public void setNull(boolean isNull) - Specified by:
setNull
in interfaceArrayWriter
- Overrides:
setNull
in classAbstractArrayWriter
-
startWrite
public void startWrite()Description copied from interface:WriterEvents
Start a write (batch) operation. Performs any vector initialization required at the start of a batch (especially for offset vectors.)- Specified by:
startWrite
in interfaceWriterEvents
- Overrides:
startWrite
in classAbstractArrayWriter.BaseArrayWriter
-
startRow
public void startRow()Description copied from interface:WriterEvents
Start a new row. To be called only when a row is not active. To restart a row, callWriterEvents.restartRow()
instead.- Specified by:
startRow
in interfaceWriterEvents
- Overrides:
startRow
in classAbstractArrayWriter.BaseArrayWriter
-
endArrayValue
public void endArrayValue()Description copied from interface:WriterEvents
End a value. Similar toWriterEvents.saveRow()
, but the save of a value is conditional on saving the row. This version is primarily of use in tuples nested inside arrays: it saves each tuple within the array, advancing to a new position in the array. The update of the array's offset vector based on the cumulative value saves is done when saving the row.- Specified by:
endArrayValue
in interfaceWriterEvents
- Overrides:
endArrayValue
in classAbstractArrayWriter.BaseArrayWriter
-
restartRow
public void restartRow()Description copied from interface:WriterEvents
During a writer to a row, rewind the the current index position to restart the row. Done when abandoning the current row, such as when filtering out a row at read time.- Specified by:
restartRow
in interfaceWriterEvents
- Overrides:
restartRow
in classAbstractArrayWriter.BaseArrayWriter
-
saveRow
public void saveRow()Description copied from interface:WriterEvents
Saves a row. Commits offset vector locations and advances each to the next position. Can be called only when a row is active.- Specified by:
saveRow
in interfaceWriterEvents
- Overrides:
saveRow
in classAbstractArrayWriter.BaseArrayWriter
-
preRollover
public void preRollover()Description copied from interface:WriterEvents
The vectors backing this vector are about to roll over. Finish the current batch up to, but not including, the current row.- Specified by:
preRollover
in interfaceWriterEvents
- Overrides:
preRollover
in classAbstractArrayWriter.BaseArrayWriter
-
postRollover
public void postRollover()Description copied from interface:WriterEvents
The vectors backing this writer rolled over. This means that data for the current row has been rolled over into a new vector. Offsets and indexes should be shifted based on the understanding that data for the current row now resides at the start of a new vector instead of its previous location elsewhere in an old vector.- Specified by:
postRollover
in interfaceWriterEvents
- Overrides:
postRollover
in classAbstractArrayWriter.BaseArrayWriter
-
endWrite
public void endWrite()Description copied from interface:WriterEvents
End a batch: finalize any vector values.- Specified by:
endWrite
in interfaceWriterEvents
- Overrides:
endWrite
in classAbstractArrayWriter.BaseArrayWriter
-
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:
array
- value to write to the vector. The Java type of the object indicates the Drill storage type
-