static List<String> executeStatementOnDriverAndReturnResults(String cmd, IDriver driver) throws Exception {
    LOG.debug("Executing: " + cmd);
    try {
      driver.run(cmd);
    } catch (CommandProcessorException e) {
      throw new IOException("Failed to execute \"" + cmd + "\". Driver returned: " + e);
    }
    List<String> rs = new ArrayList<>();
    driver.setMaxRows(400);
    driver.getResults(rs);
    return rs;
  }
Execute Hive CLI statement and get back result.
@param cmd arbitrary statement to execute
@param driver execution driver
@return the result of the query
@throws Exception failed to execute statement
itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/txn/compactor/CompactorTestUtil.java