private String getRow(ByteStream.Output bos, Utilities.StreamStatus streamStatus) {
    final String row;
    if (bos.getLength() > 0) {
      row = new String(bos.getData(), 0, bos.getLength(), StandardCharsets.UTF_8);
    } else if (streamStatus == Utilities.StreamStatus.TERMINATED) {
      row = "";
    } else {
      row = null;
    }
    return row;
  }
Set the maximum number of rows returned by getResults.
ql/src/java/org/apache/hadoop/hive/ql/Driver.java