Github user vrozov commented on a diff in the pull request:

    https://github.com/apache/drill/pull/1090#discussion_r162772482
  
    --- Diff: 
exec/java-exec/src/main/java/org/apache/drill/exec/record/selection/SelectionVector4.java
 ---
    @@ -100,8 +101,8 @@ public boolean next() {
           return false;
         }
     
    -    start = start+length;
    -    int newEnd = Math.min(start+length, recordCount);
    +    start = start + length;
    --- End diff --
    
    This code does not look right to me. It tries to enforce invariant that 
`start + length <= recordCount`, but based on the check on line 96, the 
invariant is not enforced in other places, so it is not clear why the invariant 
needs to be enforced here. If the invariant needs to be enforced, will it be 
better to use:
    ```
    start += length;
    length = Math.min(length, recordCount - start);
    ```


---

Reply via email to