public Scan setBatch(int batch) {
    if (this.hasFilter() && this.filter.hasFilterRow()) {
      throw new IncompatibleFilterException(
        "Cannot set batch on a scan using a filter" + " that returns true for filter.hasFilterRow");
    }
    this.batch = batch;
    return this;
  }
Set the maximum number of cells to return for each call to next(). Callers should be aware that
this is not equivalent to calling {@link #setAllowPartialResults(boolean)}. If you don't allow
partial results, the number of cells in each Result must equal to your batch setting unless it
is the last Result for current row. So this method is helpful in paging queries. If you just
want to prevent OOM at client, use setAllowPartialResults(true) is better.
@param batch the maximum number of values
@see Result#mayHaveMoreCellsInRow()
hbase-client/src/main/java/org/apache/hadoop/hbase/client/Scan.java