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
FieldsFields inherited from class org.apache.drill.exec.vector.accessor.reader.AbstractTupleReader
nullStateReader, readers -
Constructor Summary
ConstructorsConstructorDescriptionRowSetReaderImpl(TupleMetadata schema, ReaderIndex index, List<AbstractObjectReader> readers) RowSetReaderImpl(TupleMetadata schema, ReaderIndex index, AbstractObjectReader[] readers) -
Method Summary
Modifier and TypeMethodDescriptionbooleanhasNext()Convenience method which whether the next call toRowSetReader.next()will succeed.intBatch index: 0 for a single batch, batch for the current row is a hyper-batch.intGets the read position within the row set.voidnewBatch()Bind the reader to a new batch of data.booleannext()Advance to the next position.intoffset()The index of the underlying row which may be indexed by an SV2 or SV4.voidrewind()Reset the position to before the first row.introwCount()Total number of rows in the row set.schema()voidsetPosition(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, variantMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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:RowSetReaderAdvance 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:
nextin interfaceRowSetReader- Returns:
- true if another row is available, false if all rows have been read
-
hasNext
public boolean hasNext()Description copied from interface:RowSetReaderConvenience method which whether the next call toRowSetReader.next()will succeed. Purely optional.- Specified by:
hasNextin interfaceRowSetReader- Returns:
- true if there is another record to read, false if not
-
logicalIndex
public int logicalIndex()Description copied from interface:RowSetReaderGets 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:
logicalIndexin interfaceRowSetReader- Returns:
- current iteration position
-
rowCount
public int rowCount()Description copied from interface:RowSetReaderTotal number of rows in the row set.- Specified by:
rowCountin interfaceRowSetReader- Returns:
- total number of rows
-
offset
public int offset()Description copied from interface:RowSetReaderThe index of the underlying row which may be indexed by an SV2 or SV4.- Specified by:
offsetin interfaceRowSetReader- Returns:
- index of the underlying row
-
hyperVectorIndex
public int hyperVectorIndex()Description copied from interface:RowSetReaderBatch index: 0 for a single batch, batch for the current row is a hyper-batch.- Specified by:
hyperVectorIndexin interfaceRowSetReader- Returns:
- index of the batch for the current row
-
setPosition
public void setPosition(int index) Description copied from interface:RowSetReaderSets 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:
setPositionin interfaceRowSetReader- Parameters:
index- the desired index position
-
schema
- Specified by:
schemain interfaceColumnReader
-
tupleSchema
- Specified by:
tupleSchemain interfaceTupleReader
-
rewind
public void rewind()Description copied from interface:RowSetReaderReset the position to before the first row. Convenient method which is the same as setPosition(-1).- Specified by:
rewindin interfaceRowSetReader
-
newBatch
public void newBatch()Description copied from interface:RowSetReaderBind 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:
newBatchin interfaceRowSetReader
-