public interface ResultSetLoader
Many of the methods in this interface verify that the loader is in the proper state. For example, an exception is thrown if the caller attempts to save a row before starting a batch. However, the per-column write methods are checked only through assertions that should enabled during testing, but will be disabled during production.
VectorContainerWriter}, the class which this class
replaces
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_ROW_COUNT |
Modifier and Type | Method and Description |
---|---|
TupleMetadata |
activeSchema()
Returns the active output schema; the schema used by the writers,
minus any unprojected columns.
|
boolean |
atLimit()
After a
harvest() , call, call this method to determine if
the scan limit has been hit. |
int |
batchCount()
Total number of batches created.
|
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.
|
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 |
hasRows()
Report whether the loader currently holds rows.
|
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.
|
int |
schemaVersion()
Current schema version.
|
ResultSetLoader |
setRow(Object... values)
Load a row using column values passed as variable-length arguments.
|
void |
setTargetRowCount(int count)
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.
|
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).
|
static final int DEFAULT_ROW_COUNT
CustomErrorContext errorContext()
int schemaVersion()
void setTargetRowCount(int count)
startBatch()
.count
- target batch row countint targetRowCount()
int maxBatchSize()
int targetVectorSize()
int batchCount()
long totalRowCount()
boolean hasRows()
boolean startBatch()
true
if another batch can be read, false
if
the reader has reached the given scan limit.RowSetLoader writer()
boolean writeable()
ResultSetLoader setRow(Object... values)
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.
values
- column values in column index orderint skipRows(int requestedCount)
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.)
requestedCount
- the number of rows to skipboolean isProjectionEmpty()
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).
TupleMetadata activeSchema()
VectorContainer outputContainer()
harvest()
is called, and is no longer valid once
startBatch()
is called.VectorContainer harvest()
The schema of the returned container is defined as:
boolean atLimit()
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.true
if the scan has reached a set scan row limit,
false
if there is no limit, or more rows can be read.TupleMetadata outputSchema()
ResultVectorCache vectorCache()
void close()
Copyright © 1970 The Apache Software Foundation. All rights reserved.