Search in sources :

Example 11 with HiveSQLException

use of org.apache.hive.service.cli.HiveSQLException in project hive by apache.

the class ThriftCLIService method GetDelegationToken.

@Override
public TGetDelegationTokenResp GetDelegationToken(TGetDelegationTokenReq req) throws TException {
    TGetDelegationTokenResp resp = new TGetDelegationTokenResp();
    if (hiveAuthFactory == null || !hiveAuthFactory.isSASLKerberosUser()) {
        resp.setStatus(unsecureTokenErrorStatus());
    } else {
        try {
            String token = cliService.getDelegationToken(new SessionHandle(req.getSessionHandle()), hiveAuthFactory, req.getOwner(), req.getRenewer());
            resp.setDelegationToken(token);
            resp.setStatus(OK_STATUS);
        } catch (HiveSQLException e) {
            LOG.error("Error obtaining delegation token", e);
            TStatus tokenErrorStatus = HiveSQLException.toTStatus(e);
            tokenErrorStatus.setSqlState("42000");
            resp.setStatus(tokenErrorStatus);
        }
    }
    return resp;
}
Also used : HiveSQLException(org.apache.hive.service.cli.HiveSQLException) TStatus(org.apache.hive.service.rpc.thrift.TStatus) TGetDelegationTokenResp(org.apache.hive.service.rpc.thrift.TGetDelegationTokenResp) SessionHandle(org.apache.hive.service.cli.SessionHandle)

Example 12 with HiveSQLException

use of org.apache.hive.service.cli.HiveSQLException in project hive by apache.

the class ThriftCLIService method CancelDelegationToken.

@Override
public TCancelDelegationTokenResp CancelDelegationToken(TCancelDelegationTokenReq req) throws TException {
    TCancelDelegationTokenResp resp = new TCancelDelegationTokenResp();
    if (hiveAuthFactory == null || !hiveAuthFactory.isSASLKerberosUser()) {
        resp.setStatus(unsecureTokenErrorStatus());
    } else {
        try {
            cliService.cancelDelegationToken(new SessionHandle(req.getSessionHandle()), hiveAuthFactory, req.getDelegationToken());
            resp.setStatus(OK_STATUS);
        } catch (HiveSQLException e) {
            LOG.error("Error canceling delegation token", e);
            resp.setStatus(HiveSQLException.toTStatus(e));
        }
    }
    return resp;
}
Also used : HiveSQLException(org.apache.hive.service.cli.HiveSQLException) SessionHandle(org.apache.hive.service.cli.SessionHandle) TCancelDelegationTokenResp(org.apache.hive.service.rpc.thrift.TCancelDelegationTokenResp)

Example 13 with HiveSQLException

use of org.apache.hive.service.cli.HiveSQLException in project hive by apache.

the class ThriftCLIServiceClient method getDelegationToken.

@Override
public String getDelegationToken(SessionHandle sessionHandle, HiveAuthFactory authFactory, String owner, String renewer) throws HiveSQLException {
    TGetDelegationTokenReq req = new TGetDelegationTokenReq(sessionHandle.toTSessionHandle(), owner, renewer);
    try {
        TGetDelegationTokenResp tokenResp = cliService.GetDelegationToken(req);
        checkStatus(tokenResp.getStatus());
        return tokenResp.getDelegationToken();
    } catch (Exception e) {
        throw new HiveSQLException(e);
    }
}
Also used : HiveSQLException(org.apache.hive.service.cli.HiveSQLException) TGetDelegationTokenReq(org.apache.hive.service.rpc.thrift.TGetDelegationTokenReq) TGetDelegationTokenResp(org.apache.hive.service.rpc.thrift.TGetDelegationTokenResp) HiveSQLException(org.apache.hive.service.cli.HiveSQLException) TException(org.apache.thrift.TException)

Example 14 with HiveSQLException

use of org.apache.hive.service.cli.HiveSQLException in project hive by apache.

the class ThriftCLIServiceClient method closeSession.

/* (non-Javadoc)
   * @see org.apache.hive.service.cli.ICLIService#closeSession(org.apache.hive.service.cli.SessionHandle)
   */
@Override
public void closeSession(SessionHandle sessionHandle) throws HiveSQLException {
    try {
        TCloseSessionReq req = new TCloseSessionReq(sessionHandle.toTSessionHandle());
        TCloseSessionResp resp = cliService.CloseSession(req);
        checkStatus(resp.getStatus());
    } catch (HiveSQLException e) {
        throw e;
    } catch (Exception e) {
        throw new HiveSQLException(e);
    }
}
Also used : HiveSQLException(org.apache.hive.service.cli.HiveSQLException) TCloseSessionResp(org.apache.hive.service.rpc.thrift.TCloseSessionResp) TCloseSessionReq(org.apache.hive.service.rpc.thrift.TCloseSessionReq) HiveSQLException(org.apache.hive.service.cli.HiveSQLException) TException(org.apache.thrift.TException)

Example 15 with HiveSQLException

use of org.apache.hive.service.cli.HiveSQLException in project hive by apache.

the class ThriftCLIServiceClient method cancelOperation.

/* (non-Javadoc)
   * @see org.apache.hive.service.cli.ICLIService#cancelOperation(org.apache.hive.service.cli.OperationHandle)
   */
@Override
public void cancelOperation(OperationHandle opHandle) throws HiveSQLException {
    try {
        TCancelOperationReq req = new TCancelOperationReq(opHandle.toTOperationHandle());
        TCancelOperationResp resp = cliService.CancelOperation(req);
        checkStatus(resp.getStatus());
    } catch (HiveSQLException e) {
        throw e;
    } catch (Exception e) {
        throw new HiveSQLException(e);
    }
}
Also used : TCancelOperationReq(org.apache.hive.service.rpc.thrift.TCancelOperationReq) TCancelOperationResp(org.apache.hive.service.rpc.thrift.TCancelOperationResp) HiveSQLException(org.apache.hive.service.cli.HiveSQLException) HiveSQLException(org.apache.hive.service.cli.HiveSQLException) TException(org.apache.thrift.TException)

Aggregations

HiveSQLException (org.apache.hive.service.cli.HiveSQLException)83 OperationHandle (org.apache.hive.service.cli.OperationHandle)38 TException (org.apache.thrift.TException)25 SessionHandle (org.apache.hive.service.cli.SessionHandle)20 ExploreException (co.cask.cdap.explore.service.ExploreException)14 IOException (java.io.IOException)12 QueryHandle (co.cask.cdap.proto.QueryHandle)11 TProtocolVersion (org.apache.hive.service.rpc.thrift.TProtocolVersion)11 OperationManager (org.apache.hive.service.cli.operation.OperationManager)10 QueryStatus (co.cask.cdap.proto.QueryStatus)7 IMetaStoreClient (org.apache.hadoop.hive.metastore.IMetaStoreClient)7 SQLException (java.sql.SQLException)6 OperationStatus (org.apache.hive.service.cli.OperationStatus)5 TableSchema (org.apache.hive.service.cli.TableSchema)5 FileNotFoundException (java.io.FileNotFoundException)4 ArrayList (java.util.ArrayList)4 Metrics (org.apache.hadoop.hive.common.metrics.common.Metrics)3 HivePrivilegeObject (org.apache.hadoop.hive.ql.security.authorization.plugin.HivePrivilegeObject)3 NamespaceNotFoundException (co.cask.cdap.common.NamespaceNotFoundException)2 HandleNotFoundException (co.cask.cdap.explore.service.HandleNotFoundException)2