Github user ppadma commented on a diff in the pull request:
https://github.com/apache/drill/pull/1161#discussion_r177564887
--- Diff:
exec/java-exec/src/main/java/org/apache/drill/exec/physical/rowSet/model/ReaderIndex.java
---
@@ -28,26 +28,30 @@
public abstract class ReaderIndex implements ColumnReaderIndex {
- protected int rowIndex = -1;
+ protected int position = -1;
protected final int rowCount;
public ReaderIndex(int rowCount) {
this.rowCount = rowCount;
}
- public int position() { return rowIndex; }
- public void set(int index) { rowIndex = index; }
+ public void set(int index) {
+ assert position >= -1 && position <= rowCount;
+ position = index;
+ }
+
+ @Override
+ public int logicalIndex() { return position; }
+
+ @Override
+ public int size() { return rowCount; }
+ @Override
public boolean next() {
- if (++rowIndex < rowCount ) {
+ if (++position < rowCount) {
return true;
- } else {
- rowIndex--;
- return false;
}
+ position = rowCount;
--- End diff --
is there a need to set position to rowcount ? It will come here when
position = rowcount
---