Class RowSetReaderImpl

java.lang.Object
org.apache.drill.exec.vector.accessor.reader.AbstractTupleReader
org.apache.drill.exec.physical.rowSet.RowSetReaderImpl
All Implemented Interfaces:
RowSetReader, ColumnReader, ReaderEvents, TupleReader

public class RowSetReaderImpl extends AbstractTupleReader implements RowSetReader
Reader implementation for a row set.
  • Field Details

    • readerIndex

      protected final ReaderIndex readerIndex
  • Constructor Details

  • Method Details

    • next

      public boolean next()
      Description copied from interface: RowSetReader
      Advance to the next position. If the underlying row set has a selection vector, then moves one position in the selection vector, and to whichever data record is indexed.
      Specified by:
      next in interface RowSetReader
      Returns:
      true if another row is available, false if all rows have been read
    • hasNext

      public boolean hasNext()
      Description copied from interface: RowSetReader
      Convenience method which whether the next call to RowSetReader.next() will succeed. Purely optional.
      Specified by:
      hasNext in interface RowSetReader
      Returns:
      true if there is another record to read, false if not
    • logicalIndex

      public int logicalIndex()
      Description copied from interface: RowSetReader
      Gets the read position within the row set. If the row set has a selection vector, this is the position in that vector; the actual record location will likely differ. Use RowSetReader.offset() to get the actual row index.
      Specified by:
      logicalIndex in interface RowSetReader
      Returns:
      current iteration position
    • rowCount

      public int rowCount()
      Description copied from interface: RowSetReader
      Total number of rows in the row set.
      Specified by:
      rowCount in interface RowSetReader
      Returns:
      total number of rows
    • offset

      public int offset()
      Description copied from interface: RowSetReader
      The index of the underlying row which may be indexed by an SV2 or SV4.
      Specified by:
      offset in interface RowSetReader
      Returns:
      index of the underlying row
    • hyperVectorIndex

      public int hyperVectorIndex()
      Description copied from interface: RowSetReader
      Batch index: 0 for a single batch, batch for the current row is a hyper-batch.
      Specified by:
      hyperVectorIndex in interface RowSetReader
      Returns:
      index of the batch for the current row
    • setPosition

      public void setPosition(int index)
      Description copied from interface: RowSetReader
      Sets the iteration position. If the row set has a selection vector, this sets the index within that vector. The index must be from -1 to the RowSetReader.rowCount() - 1. Set the value to one less than the position to be read in the next call to RowSetReader.next(). An index of -1 means before the first row.
      Specified by:
      setPosition in interface RowSetReader
      Parameters:
      index - the desired index position
    • schema

      public ColumnMetadata schema()
      Specified by:
      schema in interface ColumnReader
    • tupleSchema

      public TupleMetadata tupleSchema()
      Specified by:
      tupleSchema in interface TupleReader
    • rewind

      public void rewind()
      Description copied from interface: RowSetReader
      Reset the position to before the first row. Convenient method which is the same as setPosition(-1).
      Specified by:
      rewind in interface RowSetReader
    • newBatch

      public void newBatch()
      Description copied from interface: RowSetReader
      Bind the reader to a new batch of data. The vectors are unchanged, but the buffers are different. Assumes the schema has not changed: the columns and selection vector mode remain unchanged; only the buffers changed. If the schema changes, discard this reader and rebuild a new one.
      Specified by:
      newBatch in interface RowSetReader