public boolean fetch(List res) {
    if (cachingEnabled) {
      if (currentRow >= fetchedData.size()) {
        return false;
      }
      int toIndex = Math.min(fetchedData.size(), currentRow + maxRows);
      res.addAll(fetchedData.subList(currentRow, toIndex));
      currentRow = toIndex;
      return true;
    } else {
      return executeInner(res);
    }
  }
Set the maximum number of rows returned by fetch.
ql/src/java/org/apache/hadoop/hive/ql/exec/FetchTask.java