private List<String> readResults(int nLines) throws HiveSQLException {
    if (resultReader == null) {
      SessionState sessionState = getParentSession().getSessionState();
      File tmp = sessionState.getTmpOutputFile();
      try {
        resultReader = new BufferedReader(new FileReader(tmp));
      } catch (FileNotFoundException e) {
        throw new HiveSQLException("File " + tmp + " not found", e);
      }
    }
    List<String> results = new ArrayList<String>();

    for (int i = 0; i < nLines || nLines <= 0; ++i) {
      try {
        String line = resultReader.readLine();
        if (line == null) {
          // reached the end of the result file
          break;
        } else {
          results.add(line);
        }
      } catch (IOException e) {
        throw new HiveSQLException("Unable to read line from file", e);
      }
    }
    return results;
  }
Reads the temporary results for non-Hive (non-Driver) commands to the
resulting List of strings.
@param nLines number of lines read at once. If it is <= 0, then read all lines.
service/src/java/org/apache/hive/service/cli/operation/HiveCommandOperation.java