Search in sources :

Example 21 with TException

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

the class Nimbus method createStateInZookeeper.

@Override
public void createStateInZookeeper(String key) throws TException {
    try {
        IStormClusterState state = stormClusterState;
        BlobStore store = blobStore;
        NimbusInfo ni = nimbusHostPortInfo;
        if (store instanceof LocalFsBlobStore) {
            state.setupBlobstore(key, ni, getVersionForKey(key, ni, conf));
        }
        LOG.debug("Created state in zookeeper {} {} {}", state, store, ni);
    } catch (Exception e) {
        LOG.warn("Exception while creating state in zookeeper - key: " + key, e);
        if (e instanceof TException) {
            throw (TException) e;
        }
        throw new RuntimeException(e);
    }
}
Also used : TException(org.apache.thrift.TException) LocalFsBlobStore(org.apache.storm.blobstore.LocalFsBlobStore) IStormClusterState(org.apache.storm.cluster.IStormClusterState) BlobStore(org.apache.storm.blobstore.BlobStore) LocalFsBlobStore(org.apache.storm.blobstore.LocalFsBlobStore) AuthorizationException(org.apache.storm.generated.AuthorizationException) NotAliveException(org.apache.storm.generated.NotAliveException) InterruptedIOException(java.io.InterruptedIOException) TException(org.apache.thrift.TException) IOException(java.io.IOException) AlreadyAliveException(org.apache.storm.generated.AlreadyAliveException) KeyAlreadyExistsException(org.apache.storm.generated.KeyAlreadyExistsException) KeyNotFoundException(org.apache.storm.generated.KeyNotFoundException) InvalidTopologyException(org.apache.storm.generated.InvalidTopologyException) BindException(java.net.BindException) NimbusInfo(org.apache.storm.nimbus.NimbusInfo)

Example 22 with TException

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

the class ThriftCLIService method ExecuteStatement.

@Override
public TExecuteStatementResp ExecuteStatement(TExecuteStatementReq req) throws TException {
    TExecuteStatementResp resp = new TExecuteStatementResp();
    try {
        SessionHandle sessionHandle = new SessionHandle(req.getSessionHandle());
        String statement = req.getStatement();
        Map<String, String> confOverlay = req.getConfOverlay();
        Boolean runAsync = req.isRunAsync();
        long queryTimeout = req.getQueryTimeout();
        OperationHandle operationHandle = runAsync ? cliService.executeStatementAsync(sessionHandle, statement, confOverlay, queryTimeout) : cliService.executeStatement(sessionHandle, statement, confOverlay, queryTimeout);
        resp.setOperationHandle(operationHandle.toTOperationHandle());
        resp.setStatus(OK_STATUS);
    } catch (Exception e) {
        // Note: it's rather important that this (and other methods) catch Exception, not Throwable;
        // in combination with HiveSessionProxy.invoke code, perhaps unintentionally, it used
        // to also catch all errors; and now it allows OOMs only to propagate.
        LOG.warn("Error executing statement: ", e);
        resp.setStatus(HiveSQLException.toTStatus(e));
    }
    return resp;
}
Also used : SessionHandle(org.apache.hive.service.cli.SessionHandle) OperationHandle(org.apache.hive.service.cli.OperationHandle) TExecuteStatementResp(org.apache.hive.service.rpc.thrift.TExecuteStatementResp) 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 23 with TException

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

the class ThriftCLIService method GetTableTypes.

@Override
public TGetTableTypesResp GetTableTypes(TGetTableTypesReq req) throws TException {
    TGetTableTypesResp resp = new TGetTableTypesResp();
    try {
        OperationHandle opHandle = cliService.getTableTypes(new SessionHandle(req.getSessionHandle()));
        resp.setOperationHandle(opHandle.toTOperationHandle());
        resp.setStatus(OK_STATUS);
    } catch (Exception e) {
        LOG.warn("Error getting table types: ", e);
        resp.setStatus(HiveSQLException.toTStatus(e));
    }
    return resp;
}
Also used : SessionHandle(org.apache.hive.service.cli.SessionHandle) TGetTableTypesResp(org.apache.hive.service.rpc.thrift.TGetTableTypesResp) 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 24 with TException

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

the class ThriftCLIService method GetOperationStatus.

@Override
public TGetOperationStatusResp GetOperationStatus(TGetOperationStatusReq req) throws TException {
    TGetOperationStatusResp resp = new TGetOperationStatusResp();
    OperationHandle operationHandle = new OperationHandle(req.getOperationHandle());
    try {
        OperationStatus operationStatus = cliService.getOperationStatus(operationHandle, req.isGetProgressUpdate());
        resp.setOperationState(operationStatus.getState().toTOperationState());
        HiveSQLException opException = operationStatus.getOperationException();
        resp.setTaskStatus(operationStatus.getTaskStatus());
        resp.setOperationStarted(operationStatus.getOperationStarted());
        resp.setOperationCompleted(operationStatus.getOperationCompleted());
        resp.setHasResultSet(operationStatus.getHasResultSet());
        JobProgressUpdate progressUpdate = operationStatus.jobProgressUpdate();
        ProgressMonitorStatusMapper mapper = ProgressMonitorStatusMapper.DEFAULT;
        if ("tez".equals(hiveConf.getVar(ConfVars.HIVE_EXECUTION_ENGINE))) {
            mapper = new TezProgressMonitorStatusMapper();
        }
        TJobExecutionStatus executionStatus = mapper.forStatus(progressUpdate.status);
        resp.setProgressUpdateResponse(new TProgressUpdateResp(progressUpdate.headers(), progressUpdate.rows(), progressUpdate.progressedPercentage, executionStatus, progressUpdate.footerSummary, progressUpdate.startTimeMillis));
        if (opException != null) {
            resp.setSqlState(opException.getSQLState());
            resp.setErrorCode(opException.getErrorCode());
            resp.setErrorMessage(org.apache.hadoop.util.StringUtils.stringifyException(opException));
        } else if (executionStatus == TJobExecutionStatus.NOT_AVAILABLE && OperationType.EXECUTE_STATEMENT.equals(operationHandle.getOperationType())) {
            resp.getProgressUpdateResponse().setProgressedPercentage(getProgressedPercentage(operationHandle));
        }
        resp.setStatus(OK_STATUS);
    } catch (Exception e) {
        LOG.warn("Error getting operation status: ", e);
        resp.setStatus(HiveSQLException.toTStatus(e));
    }
    return resp;
}
Also used : TJobExecutionStatus(org.apache.hive.service.rpc.thrift.TJobExecutionStatus) JobProgressUpdate(org.apache.hive.service.cli.JobProgressUpdate) TezProgressMonitorStatusMapper(org.apache.hive.service.cli.TezProgressMonitorStatusMapper) TGetOperationStatusResp(org.apache.hive.service.rpc.thrift.TGetOperationStatusResp) OperationStatus(org.apache.hive.service.cli.OperationStatus) HiveSQLException(org.apache.hive.service.cli.HiveSQLException) TezProgressMonitorStatusMapper(org.apache.hive.service.cli.TezProgressMonitorStatusMapper) ProgressMonitorStatusMapper(org.apache.hive.service.cli.ProgressMonitorStatusMapper) TProgressUpdateResp(org.apache.hive.service.rpc.thrift.TProgressUpdateResp) 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 25 with TException

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

the class ThriftCLIService method GetPrimaryKeys.

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

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