public class RowSetLoaderImpl extends AbstractTupleWriter implements RowSetLoader
AbstractTupleWriter.TupleObjectWriter, AbstractTupleWriter.TupleWriterListener
TupleWriter.UndefinedColumnException
WriterEvents.ColumnWriterListener, WriterEvents.State
childIndex, listener, logger, state, tupleSchema, vectorIndex, writers
Modifier | Constructor and Description |
---|---|
protected |
RowSetLoaderImpl(ResultSetLoaderImpl rsLoader,
TupleMetadata schema) |
Modifier and Type | Method and Description |
---|---|
RowSetLoader |
addRow(Object... values)
Write a row of values, given by Java objects.
|
RowSetLoader |
addSingleCol(Object value)
Similar to
RowSetLoader.addRow(Object...) , but for the odd case in which a
row consists of a single column that is an object array (such as for
a list or map) and so is ambiguous. |
void |
endBatch() |
boolean |
isFull()
Indicates that no more rows fit into the current row batch and that the row
batch should be harvested and sent downstream.
|
boolean |
limitReached(int maxRecords)
Used to push a limit down to the file reader.
|
ResultSetLoader |
loader() |
int |
rowCount()
The number of rows in the current row set.
|
int |
rowIndex()
The index of the current row.
|
void |
save()
Saves the current row and moves to the next row.
|
ColumnMetadata |
schema()
Returns the schema of the column associated with this writer.
|
boolean |
start()
Prepare a new row for writing.
|
addColumn, addColumn, addColumnWriter, array, array, bindIndex, bindIndex, bindListener, bindListener, column, column, copy, dict, dict, dump, endArrayValue, endWrite, isProjected, isProjected, lastWriteIndex, listener, nullable, postRollover, preRollover, restartRow, rowStartIndex, saveRow, scalar, scalar, set, setNull, setObject, size, startRow, startWrite, tuple, tuple, tupleSchema, type, type, type, variant, variant, writeIndex
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addColumn, addColumn, array, array, column, column, dict, dict, isProjected, scalar, scalar, set, size, tuple, tuple, tupleSchema, type, type, variant, variant
copy, isProjected, nullable, setNull, setObject, type
protected RowSetLoaderImpl(ResultSetLoaderImpl rsLoader, TupleMetadata schema)
public ResultSetLoader loader()
loader
in interface RowSetLoader
public RowSetLoader addRow(Object... values)
RowSetLoader
addRow
in interface RowSetLoader
values
- variable-length argument list of column valuespublic RowSetLoader addSingleCol(Object value)
RowSetLoader
RowSetLoader.addRow(Object...)
, but for the odd case in which a
row consists of a single column that is an object array (such as for
a list or map) and so is ambiguous.addSingleCol
in interface RowSetLoader
value
- value of the one and only columnpublic int rowIndex()
RowSetLoader
rowIndex
in interface RowSetLoader
public void save()
RowSetLoader
save
in interface RowSetLoader
public boolean start()
RowSetLoader
Handles a very special case: that of discarding the last row written. A reader can read a row into vectors, then "sniff" the row to check, for example, against a filter. If the row is not wanted, simply omit the call to save() and the next all to start() will discard the unsaved row.
Note that the vectors still contain values in the discarded position; just the various pointers are unset. If the batch ends before the discarded values are overwritten, the discarded values just exist at the end of the vector. Since vectors start with garbage contents, the discarded values are simply a different kind of garbage. But, if the client writes a new row, then the new row overwrites the discarded row. This works because we only change the tail part of a vector; never the internals.
start
in interface RowSetLoader
public void endBatch()
public boolean limitReached(int maxRecords)
RowSetLoader
limitReached
in interface RowSetLoader
maxRecords
- Maximum rows to be returned. (From the limit clause of the query)public boolean isFull()
RowSetLoader
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.
isFull
in interface RowSetLoader
public int rowCount()
RowSetLoader
rowCount
in interface RowSetLoader
public ColumnMetadata schema()
ColumnWriter
schema
in interface ColumnWriter
Copyright © 1970 The Apache Software Foundation. All rights reserved.