Github user paul-rogers commented on a diff in the pull request:

    https://github.com/apache/drill/pull/1161#discussion_r177833383
  
    --- 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 --
    
    Not entirely necessary. This is more for safety to force the position to a 
known good value. But, I can remove it if desired.


---

Reply via email to