Interface RowSetReader
- All Superinterfaces:
ColumnReader
,TupleReader
- All Known Implementing Classes:
RowSetReaderImpl
Reader for all types of row sets: those with or without
a selection vector. Iterates over "bare" row sets in row
order. Iterates over selection-vector based row sets in
selection vector order.
-
Method Summary
Modifier and TypeMethodDescriptionboolean
hasNext()
Convenience method which whether the next call tonext()
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.void
setPosition
(int index) Sets the iteration position.Methods inherited from interface org.apache.drill.exec.vector.accessor.ColumnReader
getAsString, getObject, isNull, schema, type
-
Method Details
-
rowCount
int rowCount()Total number of rows in the row set.- Returns:
- total number of rows
-
hasNext
boolean hasNext()Convenience method which whether the next call tonext()
will succeed. Purely optional.- Returns:
- true if there is another record to read, false if not
-
next
boolean next()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.- Returns:
- true if another row is available, false if all rows have been read
-
logicalIndex
int logicalIndex()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. Useoffset()
to get the actual row index.- Returns:
- current iteration position
-
setPosition
void setPosition(int index) 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 therowCount()
- 1. Set the value to one less than the position to be read in the next call tonext()
. An index of -1 means before the first row.- Parameters:
index
- the desired index position
-
rewind
void rewind()Reset the position to before the first row. Convenient method which is the same as setPosition(-1). -
hyperVectorIndex
int hyperVectorIndex()Batch index: 0 for a single batch, batch for the current row is a hyper-batch.- Returns:
- index of the batch for the current row
-
offset
int offset()The index of the underlying row which may be indexed by an SV2 or SV4.- Returns:
- index of the underlying row
-
newBatch
void newBatch()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.
-