Class RecordIterator

java.lang.Object
org.apache.drill.exec.record.RecordIterator
All Implemented Interfaces:
Iterable<VectorWrapper<?>>, VectorAccessible

public class RecordIterator extends Object implements 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 Details

  • 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

      public RecordBatch.IterOutcome next()
      Move iterator to next record.
      Returns:
      Status of current record batch read.
    • finished

      public boolean finished()
    • getLastOutcome

      public RecordBatch.IterOutcome 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

      public VectorWrapper<?> getValueAccessorById(Class<?> clazz, int... ids)
      Specified by:
      getValueAccessorById in interface VectorAccessible
    • getValueVectorId

      public TypedFieldId getValueVectorId(SchemaPath path)
      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 of Iterable<ValueVector>.
      Specified by:
      getValueVectorId in interface VectorAccessible
      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

      public BatchSchema 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 interface VectorAccessible
      Returns:
      schema of the current batch
    • getRecordCount

      public int getRecordCount()
      Description copied from interface: VectorAccessible
      Get the number of records.
      Specified by:
      getRecordCount in interface VectorAccessible
      Returns:
      number of records
    • iterator

      public Iterator<VectorWrapper<?>> iterator()
      Specified by:
      iterator in interface Iterable<VectorWrapper<?>>
    • getSelectionVector2

      public SelectionVector2 getSelectionVector2()
      Specified by:
      getSelectionVector2 in interface VectorAccessible
    • getSelectionVector4

      public SelectionVector4 getSelectionVector4()
      Specified by:
      getSelectionVector4 in interface VectorAccessible
    • clear

      public void clear()
    • clearInflightBatches

      public void clearInflightBatches()
    • close

      public void close()
    • toString

      public String toString()
      Overrides:
      toString in class Object