Github user ajantha-bhat commented on a diff in the pull request:

    https://github.com/apache/carbondata/pull/2816#discussion_r228183334
  
    --- Diff: 
core/src/main/java/org/apache/carbondata/core/scan/result/RowBatch.java ---
    @@ -100,4 +100,24 @@ public int getSize() {
         counter++;
         return row;
       }
    +
    +  /**
    +   * read next batch
    +   *
    +   * @param batch batch size
    +   * @return rows
    +   */
    +  public List<Object[]> nextBatch(int batch) {
    +    if (!hasNext()) {
    +      throw new NoSuchElementException();
    +    }
    +    List<Object[]> row;
    +    if (counter + batch > rows.size()) {
    +      row = rows.subList(counter, rows.size());
    +    } else {
    +      row = rows.subList(counter, counter + batch);
    +    }
    +    counter = counter + batch;
    --- End diff --
    
    What if code enters if check (line 116), incrementing a counter by batch 
size wrong. because we fetched data lesser that batch size (only till row size)


---

Reply via email to