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 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
ModifierConstructorDescriptionprotected
RepeatedListWriter
(ColumnMetadata schema, UInt4Vector offsetVector, AbstractObjectWriter elementWriter) -
Method Summary
Modifier and TypeMethodDescriptionvoid
bindListener
(RepeatedListWriter.ArrayListener listener) static AbstractObjectWriter
buildRepeatedList
(ColumnMetadata schema, RepeatedListVector vector, AbstractObjectWriter elementWriter) defineElement
(MaterializedField schema) defineElement
(ColumnMetadata schema) void
endWrite()
End a batch: finalize any vector values.void
saveRow()
Saves a row.void
startRow()
Start a new row.void
Start a write (batch) operation.Methods inherited from class org.apache.drill.exec.vector.accessor.writer.ObjectArrayWriter
save, setObject
Methods inherited from class org.apache.drill.exec.vector.accessor.writer.AbstractArrayWriter.BaseArrayWriter
bindIndex, dump, endArrayValue, lastWriteIndex, postRollover, preRollover, restartRow
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
-
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: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
-
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
-
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
-