@Override
  public TDownloadDataResp DownloadData(TDownloadDataReq req) throws TException {
    TDownloadDataResp resp = new TDownloadDataResp();
    try {
      SessionHandle sessionHandle = new SessionHandle(req.getSessionHandle());
      OperationHandle operationHandle = cliService.downloadData(
          sessionHandle,
          req.getTableName(),
          req.getQuery(),
          req.getFormat(),
          req.getDownloadOptions());
      resp.setOperationHandle(operationHandle.toTOperationHandle());
      resp.setStatus(OK_STATUS);
    } catch (Exception e) {
      LOG.warn("Error download data: ", e);
      resp.setStatus(HiveSQLException.toTStatus(e));
    }
    return resp;
  }
Create a session handle
@param req
@param res
@return
@throws HiveSQLException
@throws LoginException
@throws IOException
service/src/java/org/apache/hive/service/cli/thrift/ThriftCLIService.java