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
|
boolean |
atLimit()
After a
ResultSetLoader.harvest() , call, call this method to determine if
the scan limit has been hit. |
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.
|
int |
maxBatchSize()
The maximum number of rows for the present batch.
|
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.
|
boolean |
startBatch()
Start a new row batch.
|
boolean |
startBatch(boolean schemaOnly) |
boolean |
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.)
|
long |
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()
ResultSetLoader
schemaVersion
in interface ResultSetLoader
public boolean startBatch()
ResultSetLoader
startBatch
in interface ResultSetLoader
true
if another batch can be read, false
if
the reader has reached the given scan limit.public boolean startEmptyBatch()
public boolean startBatch(boolean schemaOnly)
public boolean hasRows()
ResultSetLoader
hasRows
in interface ResultSetLoader
public RowSetLoader writer()
ResultSetLoader
writer
in interface ResultSetLoader
public ResultSetLoader setRow(Object... values)
ResultSetLoader
If 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 ResultSetLoader
values
- column values in column index orderprotected void startRow()
RowSetLoader.start()
.protected void saveRow()
RowSetLoader.save()
.protected boolean isFull()
RowSetLoader.isFull()
public boolean writeable()
ResultSetLoader
writeable
in interface ResultSetLoader
protected int rowCount()
RowSetLoader.rowCount()
.protected org.apache.drill.exec.physical.resultSet.impl.WriterIndexImpl writerIndex()
public void setTargetRowCount(int rowCount)
ResultSetLoader
ResultSetLoader.startBatch()
.setTargetRowCount
in interface ResultSetLoader
rowCount
- target batch row countpublic int targetRowCount()
ResultSetLoader
targetRowCount
in interface ResultSetLoader
public int targetVectorSize()
ResultSetLoader
targetVectorSize
in interface ResultSetLoader
public int maxBatchSize()
ResultSetLoader
maxBatchSize
in interface ResultSetLoader
public int skipRows(int requestedCount)
ResultSetLoader
Used 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 ResultSetLoader
requestedCount
- the number of rows to skippublic boolean isProjectionEmpty()
ResultSetLoader
ResultSetLoader.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 ResultSetLoader
public void overflowed()
public boolean hasOverflow()
public VectorContainer outputContainer()
ResultSetLoader
ResultSetLoader.harvest()
is called, and is no longer valid once
ResultSetLoader.startBatch()
is called.outputContainer
in interface ResultSetLoader
public VectorContainer harvest()
ResultSetLoader
The schema of the returned container is defined as:
harvest
in interface ResultSetLoader
public boolean atLimit()
ResultSetLoader
ResultSetLoader.harvest()
, call, call this method to determine if
the scan limit has been hit. If so, treat this as the final batch
for the reader, even if more data is available to read.atLimit
in interface ResultSetLoader
true
if the scan has reached a set scan row limit,
false
if there is no limit, or more rows can be read.public TupleMetadata outputSchema()
ResultSetLoader
outputSchema
in interface ResultSetLoader
public TupleMetadata activeSchema()
ResultSetLoader
activeSchema
in interface ResultSetLoader
public void close()
ResultSetLoader
close
in interface ResultSetLoader
public int batchCount()
ResultSetLoader
batchCount
in interface ResultSetLoader
public long totalRowCount()
ResultSetLoader
totalRowCount
in interface ResultSetLoader
public 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()
ResultSetLoader
vectorCache
in interface ResultSetLoader
public int rowIndex()
public ColumnBuilder columnBuilder()
public CustomErrorContext errorContext()
ResultSetLoader
errorContext
in interface ResultSetLoader
Copyright © 1970 The Apache Software Foundation. All rights reserved.