Class AbstractScalarWriterImpl
java.lang.Object
org.apache.drill.exec.vector.accessor.writer.AbstractScalarWriter
org.apache.drill.exec.vector.accessor.writer.AbstractScalarWriterImpl
- All Implemented Interfaces:
ColumnWriter,ScalarWriter,ValueWriter,WriterEvents,WriterPosition
- Direct Known Subclasses:
BaseScalarWriter,DummyScalarWriter,NullableScalarWriter
Column writer implementation that acts as the basis for the
generated, vector-specific implementations. All set methods
throw an exception; subclasses simply override the supported
method(s).
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classWraps a scalar writer and its event handler to provide a uniform JSON-like interface for all writer types.Nested classes/interfaces inherited from interface org.apache.drill.exec.vector.accessor.writer.WriterEvents
WriterEvents.ColumnWriterListener, WriterEvents.State -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ColumnMetadataprotected ColumnWriterIndexIndicates the position in the vector to write. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidbindIndex(ColumnWriterIndex vectorIndex) Bind the writer to a writer index.voidbindSchema(ColumnMetadata schema) voiddump(HierarchicalFormatter format) voidEnd a value.booleanWhether this writer is projected (is backed by a materialized vector), or is unprojected (is just a dummy writer.) In most cases, clients can ignore whether the column is projected and just write to the writer.intPosition within the vector of the first value for the current row.voidsaveRow()Saves a row.schema()Returns the schema of the column associated with this writer.voidstartRow()Start a new row.voidStart a write (batch) operation.type()Return the object (structure) type of this writer.abstract BaseDataValueVectorvector()intCurrent write index for the writer.Methods inherited from class org.apache.drill.exec.vector.accessor.writer.AbstractScalarWriter
bindListener, conversionError, extendedType, setObject, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.drill.exec.vector.accessor.ColumnWriter
copy, nullable, setNullMethods inherited from interface org.apache.drill.exec.vector.accessor.ScalarWriter
setDefaultValue, valueTypeMethods inherited from interface org.apache.drill.exec.vector.accessor.ValueWriter
appendBytes, setBoolean, setBytes, setDate, setDecimal, setDouble, setFloat, setInt, setLong, setNull, setPeriod, setString, setTime, setTimestamp, setValueMethods inherited from interface org.apache.drill.exec.vector.accessor.writer.WriterEvents
bindListener, endWrite, postRollover, preRollover, restartRowMethods inherited from interface org.apache.drill.exec.vector.accessor.WriterPosition
lastWriteIndex
-
Field Details
-
schema
-
vectorIndex
Indicates the position in the vector to write. Set via an object so that all writers (within the same subtree) can agree on the write position. For example, all top-level, simple columns see the same row index. All columns within a repeated map see the same (inner) index, etc.
-
-
Constructor Details
-
AbstractScalarWriterImpl
public AbstractScalarWriterImpl()
-
-
Method Details
-
type
Description copied from interface:ColumnWriterReturn the object (structure) type of this writer.- Specified by:
typein interfaceColumnWriter- Returns:
- type indicating if this is a scalar, tuple or array
-
bindSchema
-
bindIndex
Description copied from interface:WriterEventsBind the writer to a writer index.- Specified by:
bindIndexin interfaceWriterEvents- Parameters:
vectorIndex- the writer index (top level or nested for arrays)
-
rowStartIndex
public int rowStartIndex()Description copied from interface:WriterPositionPosition within the vector of the first value for the current row. Note that this is always the first value for the row, even for a writer deeply nested within a hierarchy of arrays. (The first position for the current array is not exposed in this API.)- Specified by:
rowStartIndexin interfaceWriterPosition- Returns:
- the vector offset of the first value for the current row
-
writeIndex
public int writeIndex()Description copied from interface:WriterPositionCurrent write index for the writer. This is the global array location for arrays, same as the row index for top-level columns.- Specified by:
writeIndexin interfaceWriterPosition- Returns:
- current write index
-
schema
Description copied from interface:ColumnWriterReturns the schema of the column associated with this writer.- Specified by:
schemain interfaceColumnWriter- Returns:
- schema for this writer's column
-
vector
-
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
-
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
-
endArrayValue
public void endArrayValue()Description copied from interface:WriterEventsEnd 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:
endArrayValuein interfaceWriterEvents
-
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
-
isProjected
public boolean isProjected()Description copied from interface:ColumnWriterWhether this writer is projected (is backed by a materialized vector), or is unprojected (is just a dummy writer.) In most cases, clients can ignore whether the column is projected and just write to the writer. This flag handles those special cases where it is helpful to know if the column is projected or not.- Specified by:
isProjectedin interfaceColumnWriter
-
dump
- Specified by:
dumpin interfaceWriterEvents
-