private void logQueryHistory() {
    if (driverContext.getConf().getBoolVar(HiveConf.ConfVars.HIVE_QUERY_HISTORY_ENABLED)) {
      if (driverState.isClosed() || driverState.isDestroyed()) {
        LOG.warn("Driver instance {} already closed or destroyed, prevent handling query history", this);
      } else {
        QueryHistoryService.getInstance().logQuery(driverContext);
      }
    }
  }
Set the maximum number of rows returned by getResults.
ql/src/java/org/apache/hadoop/hive/ql/Driver.java