Interface WriterEvents
- All Superinterfaces:
WriterPosition
- All Known Subinterfaces:
OffsetVectorWriter,UnionShim
- All Known Implementing Classes:
AbstractArrayWriter,AbstractArrayWriter.BaseArrayWriter,AbstractFixedWidthWriter,AbstractFixedWidthWriter.BaseFixedWidthWriter,AbstractFixedWidthWriter.BaseIntWriter,AbstractScalarWriterImpl,AbstractTupleWriter,BaseScalarWriter,BaseVarWidthWriter,BitColumnWriter,ColumnAccessors.BigIntColumnWriter,ColumnAccessors.DateColumnWriter,ColumnAccessors.Decimal18ColumnWriter,ColumnAccessors.Decimal28SparseColumnWriter,ColumnAccessors.Decimal38SparseColumnWriter,ColumnAccessors.Decimal9ColumnWriter,ColumnAccessors.Float4ColumnWriter,ColumnAccessors.Float8ColumnWriter,ColumnAccessors.IntColumnWriter,ColumnAccessors.IntervalColumnWriter,ColumnAccessors.IntervalDayColumnWriter,ColumnAccessors.IntervalYearColumnWriter,ColumnAccessors.SmallIntColumnWriter,ColumnAccessors.TimeColumnWriter,ColumnAccessors.TimeStampColumnWriter,ColumnAccessors.TinyIntColumnWriter,ColumnAccessors.UInt1ColumnWriter,ColumnAccessors.UInt2ColumnWriter,ColumnAccessors.UInt4ColumnWriter,ColumnAccessors.UInt8ColumnWriter,ColumnAccessors.Var16CharColumnWriter,ColumnAccessors.VarBinaryColumnWriter,ColumnAccessors.VarCharColumnWriter,ColumnAccessors.VarDecimalColumnWriter,DictEntryWriter,DummyArrayWriter,DummyArrayWriter.DummyOffsetVectorWriter,DummyDictWriter,DummyScalarWriter,EmptyListShim,ListWriterImpl,MapWriter,MapWriter.ArrayMapWriter,MapWriter.DummyArrayMapWriter,MapWriter.DummyMapWriter,MapWriter.SingleMapWriter,NullableScalarWriter,ObjectArrayWriter,ObjectDictWriter,OffsetVectorWriterImpl,RepeatedListWriter,RowSetLoaderImpl,RowSetWriterImpl,ScalarArrayWriter,SimpleListShim,UnionShim.AbstractUnionShim,UnionVectorShim,UnionWriterImpl
Internal interface used to control the behavior
of writers. Consumers of writers never use this method; it is
instead used by the code that implements writers.
Most methods here represents events in a state machine. The top-level writer provides a set of public methods which trigger one or more of these internal events. The events draw some fine distinctions between top-level values and those nested within arrays. See each kind of writer for the details.
The events also ensure symmetry between top-level and nested tuples, especially those nested within an array. That is, an event cannot change meaning depending on whether the tuple is top-level or nested within an array. Instead, the order of calls, or selectively making or not making calls, can change.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceListener (callback) for vector overflow events.static enumTracks the write state of a tuple or variant to allow applying the correct operations to newly-added columns to synchronize them with the rest of the writers. -
Method Summary
Modifier and TypeMethodDescriptionvoidbindIndex(ColumnWriterIndex index) Bind the writer to a writer index.voidBind a listener to the underlying vector writer.voiddump(HierarchicalFormatter format) voidEnd a value.voidendWrite()End a batch: finalize any vector values.voidThe vectors backing this writer rolled over.voidThe vectors backing this vector are about to roll over.voidDuring a writer to a row, rewind the the current index position to restart the row.voidsaveRow()Saves a row.voidstartRow()Start a new row.voidStart a write (batch) operation.Methods inherited from interface org.apache.drill.exec.vector.accessor.WriterPosition
lastWriteIndex, rowStartIndex, writeIndex
-
Method Details
-
bindIndex
Bind the writer to a writer index.- Parameters:
index- the writer index (top level or nested for arrays)
-
bindListener
Bind a listener to the underlying vector writer. This listener reports on vector events (overflow, growth), and so is called only when the writer is backed by a vector. The listener is ignored (and never called) for dummy (non-projected) columns. If the column is compound (such as for a nullable or repeated column, or for a map), then the writer is bound to the individual components.- Parameters:
listener- the vector event listener to bind
-
startWrite
void startWrite()Start a write (batch) operation. Performs any vector initialization required at the start of a batch (especially for offset vectors.) -
startRow
void startRow()Start a new row. To be called only when a row is not active. To restart a row, callrestartRow()instead. -
endArrayValue
void endArrayValue()End a value. Similar tosaveRow(), 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. -
restartRow
void restartRow()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. -
saveRow
void saveRow()Saves a row. Commits offset vector locations and advances each to the next position. Can be called only when a row is active. -
endWrite
void endWrite()End a batch: finalize any vector values. -
preRollover
void preRollover()The vectors backing this vector are about to roll over. Finish the current batch up to, but not including, the current row. -
postRollover
void postRollover()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. -
dump
-