Class DummyScalarWriter
java.lang.Object
org.apache.drill.exec.vector.accessor.writer.AbstractScalarWriter
org.apache.drill.exec.vector.accessor.writer.AbstractScalarWriterImpl
org.apache.drill.exec.vector.accessor.writer.dummy.DummyScalarWriter
- All Implemented Interfaces:
ColumnWriter
,ScalarWriter
,ValueWriter
,WriterEvents
,WriterPosition
- Direct Known Subclasses:
DummyArrayWriter.DummyOffsetVectorWriter
Represents a non-projected column. The writer accepts data, but
discards it. The writer does not participate in writer events,
nor is it backed by a real vector, index or type.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.drill.exec.vector.accessor.writer.AbstractScalarWriterImpl
AbstractScalarWriterImpl.ScalarObjectWriter
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.AbstractScalarWriterImpl
schema, vectorIndex
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
appendBytes
(byte[] value, int len) void
bindIndex
(ColumnWriterIndex index) Bind the writer to a writer index.void
Bind a listener to the underlying vector writer.void
copy
(ColumnReader from) Copy a single value from the given reader, which must be of the same type as this writer.void
endWrite()
End a batch: finalize any vector values.boolean
Whether 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.int
Return the last write position in the vector.boolean
nullable()
Whether this writer allows nulls.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.int
Position within the vector of the first value for the current row.void
setBoolean
(boolean value) void
setBytes
(byte[] value, int len) void
void
setDecimal
(BigDecimal value) void
setDefaultValue
(Object value) Set the default value to be used to fill empties for this writer.void
setDouble
(double value) void
setFloat
(float value) void
setInt
(int value) void
setLong
(long value) void
setNull()
Set the current value to null.void
setPeriod
(org.joda.time.Period value) void
void
void
setTimestamp
(Instant value) void
Write value to a vector as a Java object of the "native" type for the column.Describe the type of the value.vector()
Methods inherited from class org.apache.drill.exec.vector.accessor.writer.AbstractScalarWriterImpl
bindSchema, dump, endArrayValue, saveRow, schema, startRow, startWrite, type, writeIndex
Methods inherited from class org.apache.drill.exec.vector.accessor.writer.AbstractScalarWriter
conversionError, extendedType, setObject, toString
-
Constructor Details
-
DummyScalarWriter
-
-
Method Details
-
bindListener
Description copied from interface:WriterEvents
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.- Specified by:
bindListener
in interfaceWriterEvents
- Overrides:
bindListener
in classAbstractScalarWriter
- Parameters:
listener
- the vector event listener to bind
-
valueType
Description copied from interface:ScalarWriter
Describe the type of the value. This is a compression of the value vector type: it describes which method will return the vector value.- Returns:
- the value type which indicates which get method is valid for the column
-
nullable
public boolean nullable()Description copied from interface:ColumnWriter
Whether this writer allows nulls. This is not as simple as checking for theTypeProtos.DataMode.OPTIONAL
type in the schema. List entries are nullable, if they are primitive, but not if they are maps or lists. Unions are nullable, regardless of cardinality.- Returns:
- true if a call to
ColumnWriter.setNull()
is supported, false if not
-
setNull
public void setNull()Description copied from interface:ColumnWriter
Set the current value to null. Support depends on the underlying implementation: only nullable types support this operation. throws IllegalStateException if called on a non-nullable value. -
setBoolean
public void setBoolean(boolean value) -
setInt
public void setInt(int value) -
setLong
public void setLong(long value) -
setFloat
public void setFloat(float value) -
setDouble
public void setDouble(double value) -
setString
-
setBytes
public void setBytes(byte[] value, int len) -
appendBytes
public void appendBytes(byte[] value, int len) -
setDecimal
-
setPeriod
public void setPeriod(org.joda.time.Period value) -
bindIndex
Description copied from interface:WriterEvents
Bind the writer to a writer index.- Specified by:
bindIndex
in interfaceWriterEvents
- Overrides:
bindIndex
in classAbstractScalarWriterImpl
- Parameters:
index
- the writer index (top level or nested for arrays)
-
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. -
endWrite
public void endWrite()Description copied from interface:WriterEvents
End a batch: finalize any vector values. -
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. -
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. -
lastWriteIndex
public int lastWriteIndex()Description copied from interface:WriterPosition
Return the last write position in the vector. This may be the same as the writer index position (if the vector was written at that point), or an earlier point. In either case, this value points to the last valid value in the vector.- Returns:
- index of the last valid value in the vector
-
vector
- Specified by:
vector
in classAbstractScalarWriterImpl
-
rowStartIndex
public int rowStartIndex()Description copied from interface:WriterPosition
Position 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:
rowStartIndex
in interfaceWriterPosition
- Overrides:
rowStartIndex
in classAbstractScalarWriterImpl
- Returns:
- the vector offset of the first value for the current row
-
setDate
-
setTime
-
setTimestamp
-
setValue
Description copied from interface:ValueWriter
Write value to a vector as a Java object of the "native" type for the column. This form is available only on scalar writers. The object must be of the form for the primary write method above.Primarily to be used when the code already knows the object type.
- Parameters:
value
- a value that matches the primary setter above, or null to set the column to null- See Also:
-
setDefaultValue
Description copied from interface:ScalarWriter
Set the default value to be used to fill empties for this writer. Only valid for required writers: null writers set this is-set bit to 0 and set the data value to 0.- Parameters:
value
- the value to set. Cannot be null. The type of the value must match that legal forValueWriter.setValue(Object)
-
isProjected
public boolean isProjected()Description copied from interface:ColumnWriter
Whether 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:
isProjected
in interfaceColumnWriter
- Overrides:
isProjected
in classAbstractScalarWriterImpl
-
copy
Description copied from interface:ColumnWriter
Copy a single value from the given reader, which must be of the same type as this writer.- Parameters:
from
- reader to provide the data
-