public class ResultSetLoaderImpl extends Object implements ResultSetLoader
ResultSetLoader}| Modifier and Type | Class and Description |
|---|---|
static class |
ResultSetLoaderImpl.ResultSetOptions
Read-only set of options for the result set loader.
|
| Modifier and Type | Field and Description |
|---|---|
protected int |
accumulatedBatchSize
Total bytes allocated to the current batch.
|
protected static org.slf4j.Logger |
logger |
DEFAULT_ROW_COUNT| Constructor and Description |
|---|
ResultSetLoaderImpl(BufferAllocator allocator) |
ResultSetLoaderImpl(BufferAllocator allocator,
ResultSetLoaderImpl.ResultSetOptions options) |
| Modifier and Type | Method and Description |
|---|---|
TupleMetadata |
activeSchema()
Returns the active output schema; the schema used by the writers,
minus any unprojected columns.
|
int |
activeSchemaVersion()
Reports the current schema version.
|
BufferAllocator |
allocator()
Allocator to use when allocating buffers for vectors
|
int |
batchCount()
Total number of batches created.
|
int |
bumpVersion()
Increments the schema version when adding a new column anywhere in
the writer hierarchy.
|
boolean |
canExpand(int delta)
Return whether a vector within the current batch can expand.
|
void |
close()
Called after all rows are returned, whether because no more data is
available, or the caller wishes to cancel the current row batch
and complete.
|
ColumnBuilder |
columnBuilder() |
void |
dump(HierarchicalFormatter format) |
CustomErrorContext |
errorContext()
Context for error messages.
|
VectorContainer |
harvest()
Harvest the current row batch, and reset the mutator
to the start of the next row batch (which may already contain
an overflow row.
|
boolean |
hasOverflow()
Reports whether the loader is in the overflow state.
|
boolean |
hasRows()
Report whether the loader currently holds rows.
|
protected boolean |
isFull()
Implementation of
RowSetLoader.isFull() |
boolean |
isProjectionEmpty()
Reports if this is an empty projection such as occurs in a
SELECT COUNT(*) query.
|
VectorContainer |
outputContainer()
Returns the output container which holds (or will hold) batches
from this loader.
|
TupleMetadata |
outputSchema()
The schema of the harvested batch.
|
void |
overflowed()
Indicates that an overflow has just occurred.
|
ProjectionFilter |
projectionSet() |
TupleState.RowState |
rootState() |
protected int |
rowCount()
Implementation for {#link
RowSetLoader.rowCount(). |
int |
rowIndex()
Current writer row index.
|
protected void |
saveRow()
Finalize the current row.
|
int |
schemaVersion()
Current schema version.
|
ResultSetLoader |
setRow(Object... values)
Load a row using column values passed as variable-length arguments.
|
void |
setTargetRowCount(int rowCount)
Adjust the number of rows to produce in the next batch.
|
int |
skipRows(int requestedCount)
Requests to skip the given number of rows.
|
void |
startBatch()
Start a new row batch.
|
void |
startBatch(boolean schemaOnly) |
void |
startEmptyBatch()
Start a batch to report only schema without data.
|
protected void |
startRow()
Called before writing a new row.
|
void |
tallyAllocations(int allocationBytes)
Accumulate the initial vector allocation sizes.
|
int |
targetRowCount()
The number of rows produced by this loader (as configured in the loader
options.)
|
int |
targetVectorSize()
The largest vector size produced by this loader (as specified by
the value vector limit.)
|
int |
totalRowCount()
Total number of rows loaded for all previous batches and the
current batch.
|
ResultVectorCache |
vectorCache()
Peek at the internal vector cache for readers that need a bit of help
resolving types based on what was previously seen.
|
boolean |
writeable()
Reports whether the loader is in a writable state.
|
RowSetLoader |
writer()
Writer for the top-level tuple (the entire row).
|
protected org.apache.drill.exec.physical.resultSet.impl.WriterIndexImpl |
writerIndex() |
protected static final org.slf4j.Logger logger
protected int accumulatedBatchSize
public ResultSetLoaderImpl(BufferAllocator allocator, ResultSetLoaderImpl.ResultSetOptions options)
public ResultSetLoaderImpl(BufferAllocator allocator)
public ProjectionFilter projectionSet()
public BufferAllocator allocator()
public int bumpVersion()
public int activeSchemaVersion()
public int schemaVersion()
ResultSetLoaderschemaVersion in interface ResultSetLoaderpublic void startBatch()
ResultSetLoaderstartBatch in interface ResultSetLoaderpublic void startEmptyBatch()
public void startBatch(boolean schemaOnly)
public boolean hasRows()
ResultSetLoaderhasRows in interface ResultSetLoaderpublic RowSetLoader writer()
ResultSetLoaderwriter in interface ResultSetLoaderpublic ResultSetLoader setRow(Object... values)
ResultSetLoaderIf the row consists of a single map or list, then the one value will be an Object array, creating an ambiguity. Use writer().set(0, value); in this case.
setRow in interface ResultSetLoadervalues - column values in column index orderprotected void startRow()
RowSetLoader.start().protected void saveRow()
RowSetLoader.save().protected boolean isFull()
RowSetLoader.isFull()public boolean writeable()
ResultSetLoaderwriteable in interface ResultSetLoaderprotected int rowCount()
RowSetLoader.rowCount().protected org.apache.drill.exec.physical.resultSet.impl.WriterIndexImpl writerIndex()
public void setTargetRowCount(int rowCount)
ResultSetLoaderResultSetLoader.startBatch().setTargetRowCount in interface ResultSetLoaderrowCount - target batch row countpublic int targetRowCount()
ResultSetLoadertargetRowCount in interface ResultSetLoaderpublic int targetVectorSize()
ResultSetLoadertargetVectorSize in interface ResultSetLoaderpublic int skipRows(int requestedCount)
ResultSetLoaderUsed in SELECT COUNT(*) style queries when the downstream operators want just record count, but no actual rows.
Also used to fill in a batch of only null values (such a filling in a set of null vectors for unprojected columns.)
skipRows in interface ResultSetLoaderrequestedCount - the number of rows to skippublic boolean isProjectionEmpty()
ResultSetLoaderResultSetLoader.skipRows(int) to skip over the number of rows that would
have been read if any data had been projected.
Note that the empty schema case can also occur if the project list from the SELECT clause is disjoint from the table schema. For example, SELECT a, b from a table with schema (c, d).
isProjectionEmpty in interface ResultSetLoaderpublic void overflowed()
public boolean hasOverflow()
public VectorContainer outputContainer()
ResultSetLoaderResultSetLoader.harvest() is called, and is no longer valid once
ResultSetLoader.startBatch() is called.outputContainer in interface ResultSetLoaderpublic VectorContainer harvest()
ResultSetLoaderThe schema of the returned container is defined as:
harvest in interface ResultSetLoaderpublic TupleMetadata outputSchema()
ResultSetLoaderoutputSchema in interface ResultSetLoaderpublic TupleMetadata activeSchema()
ResultSetLoaderactiveSchema in interface ResultSetLoaderpublic void close()
ResultSetLoaderclose in interface ResultSetLoaderpublic int batchCount()
ResultSetLoaderbatchCount in interface ResultSetLoaderpublic int totalRowCount()
ResultSetLoadertotalRowCount in interface ResultSetLoaderpublic TupleState.RowState rootState()
public boolean canExpand(int delta)
delta - increase in vector sizepublic void tallyAllocations(int allocationBytes)
allocationBytes - number of bytes allocated to a vector
in the batch setup steppublic void dump(HierarchicalFormatter format)
public ResultVectorCache vectorCache()
ResultSetLoadervectorCache in interface ResultSetLoaderpublic int rowIndex()
public ColumnBuilder columnBuilder()
public CustomErrorContext errorContext()
ResultSetLoadererrorContext in interface ResultSetLoaderCopyright © 2021 The Apache Software Foundation. All rights reserved.