Search in sources :

Example 26 with TException

use of org.apache.thrift.TException 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 27 with TException

use of org.apache.thrift.TException in project hive by apache.

the class ThriftCLIService method GetSchemas.

@Override
public TGetSchemasResp GetSchemas(TGetSchemasReq req) throws TException {
    TGetSchemasResp resp = new TGetSchemasResp();
    try {
        OperationHandle opHandle = cliService.getSchemas(new SessionHandle(req.getSessionHandle()), req.getCatalogName(), req.getSchemaName());
        resp.setOperationHandle(opHandle.toTOperationHandle());
        resp.setStatus(OK_STATUS);
    } catch (Exception e) {
        LOG.warn("Error getting schemas: ", e);
        resp.setStatus(HiveSQLException.toTStatus(e));
    }
    return resp;
}
Also used : SessionHandle(org.apache.hive.service.cli.SessionHandle) TGetSchemasResp(org.apache.hive.service.rpc.thrift.TGetSchemasResp) 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)

Example 28 with TException

use of org.apache.thrift.TException in project hive by apache.

the class ThriftCLIService method FetchResults.

@Override
public TFetchResultsResp FetchResults(TFetchResultsReq req) throws TException {
    TFetchResultsResp resp = new TFetchResultsResp();
    try {
        // Set fetch size
        int maxFetchSize = hiveConf.getIntVar(HiveConf.ConfVars.HIVE_SERVER2_THRIFT_RESULTSET_MAX_FETCH_SIZE);
        if (req.getMaxRows() > maxFetchSize) {
            req.setMaxRows(maxFetchSize);
        }
        RowSet rowSet = cliService.fetchResults(new OperationHandle(req.getOperationHandle()), FetchOrientation.getFetchOrientation(req.getOrientation()), req.getMaxRows(), FetchType.getFetchType(req.getFetchType()));
        resp.setResults(rowSet.toTRowSet());
        resp.setHasMoreRows(false);
        resp.setStatus(OK_STATUS);
    } catch (Exception e) {
        LOG.warn("Error fetching results: ", e);
        resp.setStatus(HiveSQLException.toTStatus(e));
    }
    return resp;
}
Also used : TFetchResultsResp(org.apache.hive.service.rpc.thrift.TFetchResultsResp) RowSet(org.apache.hive.service.cli.RowSet) 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)

Example 29 with TException

use of org.apache.thrift.TException in project hive by apache.

the class ThriftCLIService method GetColumns.

@Override
public TGetColumnsResp GetColumns(TGetColumnsReq req) throws TException {
    TGetColumnsResp resp = new TGetColumnsResp();
    try {
        OperationHandle opHandle = cliService.getColumns(new SessionHandle(req.getSessionHandle()), req.getCatalogName(), req.getSchemaName(), req.getTableName(), req.getColumnName());
        resp.setOperationHandle(opHandle.toTOperationHandle());
        resp.setStatus(OK_STATUS);
    } catch (Exception e) {
        LOG.warn("Error getting columns: ", e);
        resp.setStatus(HiveSQLException.toTStatus(e));
    }
    return resp;
}
Also used : SessionHandle(org.apache.hive.service.cli.SessionHandle) OperationHandle(org.apache.hive.service.cli.OperationHandle) TGetColumnsResp(org.apache.hive.service.rpc.thrift.TGetColumnsResp) 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)

Example 30 with TException

use of org.apache.thrift.TException in project hive by apache.

the class ThriftCLIServiceClient method cancelDelegationToken.

@Override
public void cancelDelegationToken(SessionHandle sessionHandle, HiveAuthFactory authFactory, String tokenStr) throws HiveSQLException {
    TCancelDelegationTokenReq cancelReq = new TCancelDelegationTokenReq(sessionHandle.toTSessionHandle(), tokenStr);
    try {
        TCancelDelegationTokenResp cancelResp = cliService.CancelDelegationToken(cancelReq);
        checkStatus(cancelResp.getStatus());
        return;
    } catch (TException e) {
        throw new HiveSQLException(e);
    }
}
Also used : TException(org.apache.thrift.TException) HiveSQLException(org.apache.hive.service.cli.HiveSQLException) TCancelDelegationTokenReq(org.apache.hive.service.rpc.thrift.TCancelDelegationTokenReq) TCancelDelegationTokenResp(org.apache.hive.service.rpc.thrift.TCancelDelegationTokenResp)

Aggregations

TException (org.apache.thrift.TException)325 IOException (java.io.IOException)135 MetaException (org.apache.hadoop.hive.metastore.api.MetaException)41 HashMap (java.util.HashMap)36 NoSuchObjectException (org.apache.hadoop.hive.metastore.api.NoSuchObjectException)35 ArrayList (java.util.ArrayList)32 Table (org.apache.hadoop.hive.metastore.api.Table)27 AuthorizationException (org.apache.storm.generated.AuthorizationException)27 Map (java.util.Map)26 InterruptedIOException (java.io.InterruptedIOException)24 BindException (java.net.BindException)24 UnknownHostException (java.net.UnknownHostException)22 TProtocol (org.apache.thrift.protocol.TProtocol)21 FileNotFoundException (java.io.FileNotFoundException)20 List (java.util.List)20 LoginException (javax.security.auth.login.LoginException)20 HiveSQLException (org.apache.hive.service.cli.HiveSQLException)20 TTransportException (org.apache.thrift.transport.TTransportException)19 ServiceException (org.apache.hive.service.ServiceException)18 Test (org.junit.Test)18