Class RowSetWriterImpl
java.lang.Object
org.apache.drill.exec.vector.accessor.writer.AbstractTupleWriter
org.apache.drill.exec.physical.rowSet.RowSetWriterImpl
- All Implemented Interfaces:
RowSetWriter,ColumnWriter,TupleWriter,WriterEvents,WriterPosition
Implementation of a row set writer. Only available for newly-created,
empty, direct, single row sets. Rewriting is not allowed, nor is writing
to a hyper row set.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.drill.exec.vector.accessor.writer.AbstractTupleWriter
AbstractTupleWriter.TupleObjectWriter, AbstractTupleWriter.TupleWriterListenerNested classes/interfaces inherited from interface org.apache.drill.exec.vector.accessor.TupleWriter
TupleWriter.UndefinedColumnExceptionNested 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.AbstractTupleWriter
childIndex, listener, logger, state, tupleSchema, vectorIndex, writers -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedRowSetWriterImpl(RowSet.ExtendableRowSet rowSet, TupleMetadata schema, org.apache.drill.exec.physical.rowSet.RowSetWriterImpl.WriterIndexImpl index, List<AbstractObjectWriter> writers) -
Method Summary
Modifier and TypeMethodDescriptionWrite a row of values, given by Java objects.addSingleCol(Object value) done()Finish writing and finalize the row set being written.booleanisFull()Indicates if the current row position is valid for writing.intReturn the last write position in the vector.introwIndex()voidsave()Saves the current row and moves to the next row.schema()Returns the schema of the column associated with this writer.Methods inherited from class org.apache.drill.exec.vector.accessor.writer.AbstractTupleWriter
addColumn, addColumn, addColumnWriter, array, array, bindIndex, bindIndex, bindListener, bindListener, column, column, copy, dict, dict, dump, endArrayValue, endWrite, isProjected, isProjected, listener, nullable, postRollover, preRollover, restartRow, rowStartIndex, saveRow, scalar, scalar, set, setNull, setObject, size, startRow, startWrite, tuple, tuple, tupleSchema, type, type, type, variant, variant, writeIndexMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.drill.exec.vector.accessor.ColumnWriter
copy, isProjected, nullable, setNull, setObject, type
-
Constructor Details
-
RowSetWriterImpl
protected RowSetWriterImpl(RowSet.ExtendableRowSet rowSet, TupleMetadata schema, org.apache.drill.exec.physical.rowSet.RowSetWriterImpl.WriterIndexImpl index, List<AbstractObjectWriter> writers)
-
-
Method Details
-
addRow
Description copied from interface:RowSetWriterWrite a row of values, given by Java objects. Object type must match expected column type. Stops writing, and returns false, if any value causes vector overflow. Value format:- For scalars, the value as a suitable Java type (int or Integer, say, for INTEGER values.)
- For scalar arrays, an array of a suitable Java primitive type for scalars. For example, int[] for an INTEGER column.
- For a Map, an Object array with values encoded as above. (In fact, the list here is the same as the map format.
- For a list (repeated map, list of list), an Object array with values encoded as above. (So, for a repeated map, an outer Object map encodes the array, an inner one encodes the map members.
- Specified by:
addRowin interfaceRowSetWriter- Parameters:
values- variable-length argument list of column values
-
addSingleCol
- Specified by:
addSingleColin interfaceRowSetWriter
-
rowIndex
public int rowIndex()- Specified by:
rowIndexin interfaceRowSetWriter
-
save
public void save()Description copied from interface:RowSetWriterSaves the current row and moves to the next row. Done automatically if using setRow().- Specified by:
savein interfaceRowSetWriter
-
isFull
public boolean isFull()Description copied from interface:RowSetWriterIndicates if the current row position is valid for writing. Will be false on the first row, and all subsequent rows until either the maximum number of rows are written, or a vector overflows. After that, will return true. The method returns false as soon as any column writer overflows even in the middle of a row write. That is, this writer does not automatically handle overflow rows because that added complexity is seldom needed for tests.- Specified by:
isFullin interfaceRowSetWriter- Returns:
- true if the current row can be written, false if not
-
done
Description copied from interface:RowSetWriterFinish writing and finalize the row set being written.- Specified by:
donein interfaceRowSetWriter- Returns:
- the completed, read-only row set without a selection vector
-
lastWriteIndex
public int lastWriteIndex()Description copied from interface:WriterPositionReturn 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.- Specified by:
lastWriteIndexin interfaceWriterPosition- Overrides:
lastWriteIndexin classAbstractTupleWriter- Returns:
- index of the last valid value in the vector
-
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
-