public abstract class AbstractPojoRecordReader<T> extends AbstractRecordReader implements Iterable<T>
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_RECORDS_PER_BATCH |
protected List<T> |
records |
protected List<PojoWriter> |
writers |
DEFAULT_TEXT_COLS_TO_READ
ALLOCATOR_INITIAL_RESERVATION, ALLOCATOR_MAX_RESERVATION
Modifier | Constructor and Description |
---|---|
protected |
AbstractPojoRecordReader(List<T> records) |
protected |
AbstractPojoRecordReader(List<T> records,
int recordsPerBatch) |
Modifier and Type | Method and Description |
---|---|
void |
allocate(Map<String,ValueVector> vectorMap) |
void |
close() |
protected abstract Object |
getFieldValue(T row,
int fieldPosition)
Retrieves field value to be written based for given row and field position.
|
protected PojoWriter |
initWriter(Class<?> type,
String fieldName,
OutputMutator output)
Creates writer based input class type and then initiates it.
|
Iterator<T> |
iterator() |
int |
next()
Increments this record reader forward, writing via the provided output
mutator into the output batch.
|
void |
setup(OperatorContext context,
OutputMutator output)
Configure the RecordReader with the provided schema and the record batch that should be written to.
|
protected abstract List<PojoWriter> |
setupWriters(OutputMutator output)
Setups writers for each field in the row.
|
getColumns, getDefaultColumnsToRead, hasNext, isSkipQuery, isStarQuery, setColumns, toString, transformColumns
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
forEach, spliterator
public static final int DEFAULT_RECORDS_PER_BATCH
protected List<PojoWriter> writers
public void setup(OperatorContext context, OutputMutator output) throws ExecutionSetupException
RecordReader
setup
in interface RecordReader
context
- operator context for the readeroutput
- The place where output for a particular scan should be written. The record reader is responsible for
mutating the set of schema values for that particular record.ExecutionSetupException
public int next()
RecordReader
next
in interface RecordReader
public void allocate(Map<String,ValueVector> vectorMap) throws OutOfMemoryException
allocate
in interface RecordReader
allocate
in class AbstractRecordReader
OutOfMemoryException
public void close()
close
in interface AutoCloseable
protected PojoWriter initWriter(Class<?> type, String fieldName, OutputMutator output) throws ExecutionSetupException
type
- class typefieldName
- field nameoutput
- output mutatorExecutionSetupException
protected abstract List<PojoWriter> setupWriters(OutputMutator output) throws ExecutionSetupException
output
- output mutatorExecutionSetupException
Copyright © 1970 The Apache Software Foundation. All rights reserved.