Class RepeatedListWriter
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.RepeatedListWriter
- All Implemented Interfaces:
ArrayWriter,ColumnWriter,WriterEvents,WriterPosition
Implements a writer for a repeated list. A repeated list is really
an array of arrays. It is an "array" because it does not support
nulls. (The Drill [non-repeated] "list vector" does support nulls.)
The terminology is confusing, but it is what Drill has settled upon.
Because repeated lists can be nested, they support incremental construction. Build the outer array, then the inner, then the leaf to build a 3D array. Since building is incremental, this form of array must track state and use the state to keep the newly-added element writer in sync.
To keep things (relatively) simple, the repeated list array starts out with an inner list. For the row set writer, the inner list is the actual element writer. For the result set loader, the inner list is a dummy, to be replaced by the real one once it is discovered by reading data (or by parsing a schema.)
-
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
Fields inherited from class org.apache.drill.exec.vector.accessor.writer.AbstractArrayWriter
elementIndex, elementObjWriter, offsetsWriter, outerIndex -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedRepeatedListWriter(ColumnMetadata schema, UInt4Vector offsetVector, AbstractObjectWriter elementWriter) -
Method Summary
Modifier and TypeMethodDescriptionvoidbindListener(RepeatedListWriter.ArrayListener listener) static AbstractObjectWriterbuildRepeatedList(ColumnMetadata schema, RepeatedListVector vector, AbstractObjectWriter elementWriter) defineElement(MaterializedField schema) defineElement(ColumnMetadata schema) voidendWrite()End a batch: finalize any vector values.voidsaveRow()Saves a row.voidstartRow()Start a new row.voidStart a write (batch) operation.Methods inherited from class org.apache.drill.exec.vector.accessor.writer.ObjectArrayWriter
save, setObjectMethods inherited from class org.apache.drill.exec.vector.accessor.writer.AbstractArrayWriter.BaseArrayWriter
bindIndex, dump, endArrayValue, lastWriteIndex, postRollover, preRollover, restartRowMethods 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
-
Constructor Details
-
RepeatedListWriter
protected RepeatedListWriter(ColumnMetadata schema, UInt4Vector offsetVector, AbstractObjectWriter elementWriter)
-
-
Method Details
-
buildRepeatedList
public static AbstractObjectWriter buildRepeatedList(ColumnMetadata schema, RepeatedListVector vector, AbstractObjectWriter elementWriter) -
bindListener
-
defineElement
-
defineElement
-
startWrite
public void startWrite()Description copied from interface:WriterEventsStart a write (batch) operation. Performs any vector initialization required at the start of a batch (especially for offset vectors.)- Specified by:
startWritein interfaceWriterEvents- Overrides:
startWritein classAbstractArrayWriter.BaseArrayWriter
-
startRow
public void startRow()Description copied from interface:WriterEventsStart a new row. To be called only when a row is not active. To restart a row, callWriterEvents.restartRow()instead.- Specified by:
startRowin interfaceWriterEvents- Overrides:
startRowin classAbstractArrayWriter.BaseArrayWriter
-
saveRow
public void saveRow()Description copied from interface:WriterEventsSaves a row. Commits offset vector locations and advances each to the next position. Can be called only when a row is active.- Specified by:
saveRowin interfaceWriterEvents- Overrides:
saveRowin classAbstractArrayWriter.BaseArrayWriter
-
endWrite
public void endWrite()Description copied from interface:WriterEventsEnd a batch: finalize any vector values.- Specified by:
endWritein interfaceWriterEvents- Overrides:
endWritein classAbstractArrayWriter.BaseArrayWriter
-