code: 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) {
          LOG.error("File " + tmp + " not found. ", e);
          throw new HiveSQLException(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) {
          LOG.error("Reading temp results encountered an exception: ", e);
          throw new HiveSQLException(e);
        }
      }
      return results;
    }
docs: 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.