Search in sources :

Example 1 with TGetCatalogsResp

use of org.apache.hive.service.rpc.thrift.TGetCatalogsResp in project hive by apache.

the class ThriftCLIService method GetCatalogs.

@Override
public TGetCatalogsResp GetCatalogs(TGetCatalogsReq req) throws TException {
    TGetCatalogsResp resp = new TGetCatalogsResp();
    try {
        OperationHandle opHandle = cliService.getCatalogs(new SessionHandle(req.getSessionHandle()));
        resp.setOperationHandle(opHandle.toTOperationHandle());
        resp.setStatus(OK_STATUS);
    } catch (Exception e) {
        LOG.warn("Error getting catalogs: ", e);
        resp.setStatus(HiveSQLException.toTStatus(e));
    }
    return resp;
}
Also used : SessionHandle(org.apache.hive.service.cli.SessionHandle) OperationHandle(org.apache.hive.service.cli.OperationHandle) LoginException(javax.security.auth.login.LoginException) ServiceException(org.apache.hive.service.ServiceException) HiveSQLException(org.apache.hive.service.cli.HiveSQLException) TException(org.apache.thrift.TException) IOException(java.io.IOException) UnknownHostException(java.net.UnknownHostException) TGetCatalogsResp(org.apache.hive.service.rpc.thrift.TGetCatalogsResp)

Example 2 with TGetCatalogsResp

use of org.apache.hive.service.rpc.thrift.TGetCatalogsResp in project hive by apache.

the class ThriftCLIServiceClient method getCatalogs.

/* (non-Javadoc)
   * @see org.apache.hive.service.cli.ICLIService#getCatalogs(org.apache.hive.service.cli.SessionHandle)
   */
@Override
public OperationHandle getCatalogs(SessionHandle sessionHandle) throws HiveSQLException {
    try {
        TGetCatalogsReq req = new TGetCatalogsReq(sessionHandle.toTSessionHandle());
        TGetCatalogsResp resp = cliService.GetCatalogs(req);
        checkStatus(resp.getStatus());
        TProtocolVersion protocol = sessionHandle.getProtocolVersion();
        return new OperationHandle(resp.getOperationHandle(), protocol);
    } catch (HiveSQLException e) {
        throw e;
    } catch (Exception e) {
        throw new HiveSQLException(e);
    }
}
Also used : TGetCatalogsReq(org.apache.hive.service.rpc.thrift.TGetCatalogsReq) TProtocolVersion(org.apache.hive.service.rpc.thrift.TProtocolVersion) HiveSQLException(org.apache.hive.service.cli.HiveSQLException) OperationHandle(org.apache.hive.service.cli.OperationHandle) HiveSQLException(org.apache.hive.service.cli.HiveSQLException) TException(org.apache.thrift.TException) TGetCatalogsResp(org.apache.hive.service.rpc.thrift.TGetCatalogsResp)

Example 3 with TGetCatalogsResp

use of org.apache.hive.service.rpc.thrift.TGetCatalogsResp in project hive by apache.

the class HiveDatabaseMetaData method getCatalogs.

public ResultSet getCatalogs() throws SQLException {
    TGetCatalogsResp catalogResp;
    try {
        catalogResp = client.GetCatalogs(new TGetCatalogsReq(sessHandle));
    } catch (TException e) {
        throw new SQLException(e.getMessage(), "08S01", e);
    }
    Utils.verifySuccess(catalogResp.getStatus());
    return new HiveQueryResultSet.Builder(connection).setClient(client).setSessionHandle(sessHandle).setStmtHandle(catalogResp.getOperationHandle()).build();
}
Also used : TException(org.apache.thrift.TException) TGetCatalogsReq(org.apache.hive.service.rpc.thrift.TGetCatalogsReq) SQLException(java.sql.SQLException) TGetCatalogsResp(org.apache.hive.service.rpc.thrift.TGetCatalogsResp)

Aggregations

TGetCatalogsResp (org.apache.hive.service.rpc.thrift.TGetCatalogsResp)3 TException (org.apache.thrift.TException)3 HiveSQLException (org.apache.hive.service.cli.HiveSQLException)2 OperationHandle (org.apache.hive.service.cli.OperationHandle)2 TGetCatalogsReq (org.apache.hive.service.rpc.thrift.TGetCatalogsReq)2 IOException (java.io.IOException)1 UnknownHostException (java.net.UnknownHostException)1 SQLException (java.sql.SQLException)1 LoginException (javax.security.auth.login.LoginException)1 ServiceException (org.apache.hive.service.ServiceException)1 SessionHandle (org.apache.hive.service.cli.SessionHandle)1 TProtocolVersion (org.apache.hive.service.rpc.thrift.TProtocolVersion)1