Package org.apache.drill.exec.record
Class RecordIterator
java.lang.Object
org.apache.drill.exec.record.RecordIterator
- All Implemented Interfaces:
Iterable<VectorWrapper<?>>
,VectorAccessible
RecordIterator iterates over incoming record batches one record at a time.
It allows to mark a position during iteration and reset back.
RecordIterator will hold onto multiple record batches in order to support resetting beyond record batch boundary.
-
Constructor Summary
ConstructorDescriptionRecordIterator
(RecordBatch incoming, AbstractRecordBatch<?> outgoing, OperatorContext oContext, int inputIndex, boolean enableMarkAndReset, RecordBatchMemoryManager callBack) RecordIterator
(RecordBatch incoming, AbstractRecordBatch<?> outgoing, OperatorContext oContext, int inputIndex, RecordBatchMemoryManager callBack) -
Method Summary
Modifier and TypeMethodDescriptionMap<org.apache.drill.shaded.guava.com.google.common.collect.Range<Long>,
RecordBatchData> void
clear()
void
void
close()
boolean
finished()
void
forward
(long delta) int
int
long
int
Get the number of records.Get the schema of the current RecordBatch.long
getValueAccessorById
(Class<?> clazz, int... ids) getValueVectorId
(SchemaPath path) Get the value vector type and id for the given schema path.iterator()
void
mark()
next()
Move iterator to next record.void
prepare()
buildSchema calls next() in order to read schema quikcly.void
reset()
toString()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
RecordIterator
public RecordIterator(RecordBatch incoming, AbstractRecordBatch<?> outgoing, OperatorContext oContext, int inputIndex, RecordBatchMemoryManager callBack) -
RecordIterator
public RecordIterator(RecordBatch incoming, AbstractRecordBatch<?> outgoing, OperatorContext oContext, int inputIndex, boolean enableMarkAndReset, RecordBatchMemoryManager callBack)
-
-
Method Details
-
mark
public void mark() -
reset
public void reset() -
forward
public void forward(long delta) -
prepare
public void prepare()buildSchema calls next() in order to read schema quikcly. Make sure we have fetched next non-empty batch at the end of the prepare. After prepare position of iterator is at 0. -
next
Move iterator to next record.- Returns:
- Status of current record batch read.
-
finished
public boolean finished() -
getLastOutcome
-
getTotalRecordCount
public long getTotalRecordCount() -
getInnerRecordCount
public int getInnerRecordCount() -
getOuterPosition
public long getOuterPosition() -
getCurrentPosition
public int getCurrentPosition() -
cachedBatches
public Map<org.apache.drill.shaded.guava.com.google.common.collect.Range<Long>,RecordBatchData> cachedBatches() -
getValueAccessorById
- Specified by:
getValueAccessorById
in interfaceVectorAccessible
-
getValueVectorId
Description copied from interface:VectorAccessible
Get the value vector type and id for the given schema path. The TypedFieldId should store a fieldId which is the same as the ordinal position of the field within the Iterator provided this classes implementation ofIterable<ValueVector>
.
- Specified by:
getValueVectorId
in interfaceVectorAccessible
- Parameters:
path
- the path where the vector should be located.- Returns:
- the local field id associated with this vector. If no field matches this path, this will return a null TypedFieldId
-
getSchema
Description copied from interface:VectorAccessible
Get the schema of the current RecordBatch. This changes if and only if a *_NEW_SCHEMA IterOutcome is provided.- Specified by:
getSchema
in interfaceVectorAccessible
- Returns:
- schema of the current batch
-
getRecordCount
public int getRecordCount()Description copied from interface:VectorAccessible
Get the number of records.- Specified by:
getRecordCount
in interfaceVectorAccessible
- Returns:
- number of records
-
iterator
- Specified by:
iterator
in interfaceIterable<VectorWrapper<?>>
-
getSelectionVector2
- Specified by:
getSelectionVector2
in interfaceVectorAccessible
-
getSelectionVector4
- Specified by:
getSelectionVector4
in interfaceVectorAccessible
-
clear
public void clear() -
clearInflightBatches
public void clearInflightBatches() -
close
public void close() -
toString
-