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
Reader implementation for a row set.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.drill.exec.vector.accessor.reader.AbstractTupleReader
AbstractTupleReader.TupleObjectReader
-
Field Summary
Fields inherited from class org.apache.drill.exec.vector.accessor.reader.AbstractTupleReader
nullStateReader, readers
-
Constructor Summary
ConstructorDescriptionRowSetReaderImpl
(TupleMetadata schema, ReaderIndex index, List<AbstractObjectReader> readers) RowSetReaderImpl
(TupleMetadata schema, ReaderIndex index, AbstractObjectReader[] readers) -
Method Summary
Modifier and TypeMethodDescriptionboolean
hasNext()
Convenience method which whether the next call toRowSetReader.next()
will succeed.int
Batch index: 0 for a single batch, batch for the current row is a hyper-batch.int
Gets the read position within the row set.void
newBatch()
Bind the reader to a new batch of data.boolean
next()
Advance to the next position.int
offset()
The index of the underlying row which may be indexed by an SV2 or SV4.void
rewind()
Reset the position to before the first row.int
rowCount()
Total number of rows in the row set.schema()
void
setPosition
(int index) Sets the iteration position.Methods inherited from class org.apache.drill.exec.vector.accessor.reader.AbstractTupleReader
array, array, bindBuffer, bindIndex, bindNullState, column, column, columnCount, dict, dict, getAsString, getObject, isNull, nullStateReader, reposition, scalar, scalar, tuple, tuple, type, type, type, variant, variant
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.apache.drill.exec.vector.accessor.ColumnReader
getAsString, getObject, isNull, type
-
Field Details
-
readerIndex
-
-
Constructor Details
-
RowSetReaderImpl
-
RowSetReaderImpl
public RowSetReaderImpl(TupleMetadata schema, ReaderIndex index, List<AbstractObjectReader> readers)
-
-
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 interfaceRowSetReader
- 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 toRowSetReader.next()
will succeed. Purely optional.- Specified by:
hasNext
in interfaceRowSetReader
- 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. UseRowSetReader.offset()
to get the actual row index.- Specified by:
logicalIndex
in interfaceRowSetReader
- 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 interfaceRowSetReader
- 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 interfaceRowSetReader
- 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 interfaceRowSetReader
- 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 theRowSetReader.rowCount()
- 1. Set the value to one less than the position to be read in the next call toRowSetReader.next()
. An index of -1 means before the first row.- Specified by:
setPosition
in interfaceRowSetReader
- Parameters:
index
- the desired index position
-
schema
- Specified by:
schema
in interfaceColumnReader
-
tupleSchema
- Specified by:
tupleSchema
in interfaceTupleReader
-
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 interfaceRowSetReader
-
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 interfaceRowSetReader
-