Search in sources :

Example 76 with OperationHandle

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

the class ThriftCLIService method CancelOperation.

@Override
public TCancelOperationResp CancelOperation(TCancelOperationReq req) throws TException {
    TCancelOperationResp resp = new TCancelOperationResp();
    try {
        cliService.cancelOperation(new OperationHandle(req.getOperationHandle()));
        resp.setStatus(OK_STATUS);
    } catch (Exception e) {
        LOG.error("Failed to get cancel operation [request: {}]", req, e);
        resp.setStatus(HiveSQLException.toTStatus(e));
    }
    return resp;
}
Also used : TCancelOperationResp(org.apache.hive.service.rpc.thrift.TCancelOperationResp) OperationHandle(org.apache.hive.service.cli.OperationHandle) ServiceException(org.apache.hive.service.ServiceException) TException(org.apache.thrift.TException) IOException(java.io.IOException) UnknownHostException(java.net.UnknownHostException) LoginException(javax.security.auth.login.LoginException) HiveSQLException(org.apache.hive.service.cli.HiveSQLException)

Example 77 with OperationHandle

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

the class ThriftCLIService method GetFunctions.

@Override
public TGetFunctionsResp GetFunctions(TGetFunctionsReq req) throws TException {
    TGetFunctionsResp resp = new TGetFunctionsResp();
    try {
        OperationHandle opHandle = cliService.getFunctions(new SessionHandle(req.getSessionHandle()), req.getCatalogName(), req.getSchemaName(), req.getFunctionName());
        resp.setOperationHandle(opHandle.toTOperationHandle());
        resp.setStatus(OK_STATUS);
    } catch (Exception e) {
        LOG.error("Failed to get function: [request: {}]", req, e);
        resp.setStatus(HiveSQLException.toTStatus(e));
    }
    return resp;
}
Also used : TGetFunctionsResp(org.apache.hive.service.rpc.thrift.TGetFunctionsResp) SessionHandle(org.apache.hive.service.cli.SessionHandle) OperationHandle(org.apache.hive.service.cli.OperationHandle) ServiceException(org.apache.hive.service.ServiceException) TException(org.apache.thrift.TException) IOException(java.io.IOException) UnknownHostException(java.net.UnknownHostException) LoginException(javax.security.auth.login.LoginException) HiveSQLException(org.apache.hive.service.cli.HiveSQLException)

Example 78 with OperationHandle

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

the class HiveSessionImpl method getPrimaryKeys.

@Override
public OperationHandle getPrimaryKeys(String catalog, String schema, String table) throws HiveSQLException {
    acquire(true, true);
    OperationManager operationManager = getOperationManager();
    GetPrimaryKeysOperation operation = operationManager.newGetPrimaryKeysOperation(getSession(), catalog, schema, table);
    OperationHandle opHandle = operation.getHandle();
    try {
        addOpHandle(opHandle);
        operation.run();
        return opHandle;
    } catch (HiveSQLException e) {
        removeOpHandle(opHandle);
        operationManager.closeOperation(opHandle);
        throw e;
    } finally {
        release(true, true);
    }
}
Also used : HiveSQLException(org.apache.hive.service.cli.HiveSQLException) OperationManager(org.apache.hive.service.cli.operation.OperationManager) GetPrimaryKeysOperation(org.apache.hive.service.cli.operation.GetPrimaryKeysOperation) OperationHandle(org.apache.hive.service.cli.OperationHandle)

Example 79 with OperationHandle

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

the class HiveSessionImpl method getSchemas.

@Override
public OperationHandle getSchemas(String catalogName, String schemaName) throws HiveSQLException {
    acquire(true, true);
    OperationManager operationManager = getOperationManager();
    GetSchemasOperation operation = operationManager.newGetSchemasOperation(getSession(), catalogName, schemaName);
    OperationHandle opHandle = operation.getHandle();
    try {
        addOpHandle(opHandle);
        operation.run();
        return opHandle;
    } catch (HiveSQLException e) {
        removeOpHandle(opHandle);
        operationManager.closeOperation(opHandle);
        throw e;
    } finally {
        release(true, true);
    }
}
Also used : GetSchemasOperation(org.apache.hive.service.cli.operation.GetSchemasOperation) HiveSQLException(org.apache.hive.service.cli.HiveSQLException) OperationManager(org.apache.hive.service.cli.operation.OperationManager) OperationHandle(org.apache.hive.service.cli.OperationHandle)

Example 80 with OperationHandle

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

the class HiveSessionImpl method getTables.

@Override
public OperationHandle getTables(String catalogName, String schemaName, String tableName, List<String> tableTypes) throws HiveSQLException {
    acquire(true, true);
    OperationManager operationManager = getOperationManager();
    MetadataOperation operation = operationManager.newGetTablesOperation(getSession(), catalogName, schemaName, tableName, tableTypes);
    OperationHandle opHandle = operation.getHandle();
    try {
        addOpHandle(opHandle);
        operation.run();
        return opHandle;
    } catch (HiveSQLException e) {
        removeOpHandle(opHandle);
        operationManager.closeOperation(opHandle);
        throw e;
    } finally {
        release(true, true);
    }
}
Also used : MetadataOperation(org.apache.hive.service.cli.operation.MetadataOperation) HiveSQLException(org.apache.hive.service.cli.HiveSQLException) OperationManager(org.apache.hive.service.cli.operation.OperationManager) OperationHandle(org.apache.hive.service.cli.OperationHandle)

Aggregations

OperationHandle (org.apache.hive.service.cli.OperationHandle)104 HiveSQLException (org.apache.hive.service.cli.HiveSQLException)63 SessionHandle (org.apache.hive.service.cli.SessionHandle)47 Test (org.junit.Test)35 TException (org.apache.thrift.TException)31 RowSet (org.apache.hive.service.cli.RowSet)21 IOException (java.io.IOException)20 UnknownHostException (java.net.UnknownHostException)17 LoginException (javax.security.auth.login.LoginException)17 ServiceException (org.apache.hive.service.ServiceException)17 OperationManager (org.apache.hive.service.cli.operation.OperationManager)14 TProtocolVersion (org.apache.hive.service.rpc.thrift.TProtocolVersion)13 ExploreException (co.cask.cdap.explore.service.ExploreException)12 TOperationHandle (org.apache.hive.service.rpc.thrift.TOperationHandle)12 QueryHandle (co.cask.cdap.proto.QueryHandle)11 OperationStatus (org.apache.hive.service.cli.OperationStatus)8 HashMap (java.util.HashMap)7 CLIServiceClient (org.apache.hive.service.cli.CLIServiceClient)6 ArrayList (java.util.ArrayList)5 OperationState (org.apache.hive.service.cli.OperationState)5