Search in sources :

Example 71 with OperationHandle

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

the class ThriftCLIService method GetTypeInfo.

@Override
public TGetTypeInfoResp GetTypeInfo(TGetTypeInfoReq req) throws TException {
    TGetTypeInfoResp resp = new TGetTypeInfoResp();
    try {
        OperationHandle operationHandle = cliService.getTypeInfo(new SessionHandle(req.getSessionHandle()));
        resp.setOperationHandle(operationHandle.toTOperationHandle());
        resp.setStatus(OK_STATUS);
    } catch (Exception e) {
        LOG.error("Failed to get type info [request: {}]", req, e);
        resp.setStatus(HiveSQLException.toTStatus(e));
    }
    return resp;
}
Also used : TGetTypeInfoResp(org.apache.hive.service.rpc.thrift.TGetTypeInfoResp) 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 72 with OperationHandle

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

the class ThriftCLIService method GetResultSetMetadata.

@Override
public TGetResultSetMetadataResp GetResultSetMetadata(TGetResultSetMetadataReq req) throws TException {
    TGetResultSetMetadataResp resp = new TGetResultSetMetadataResp();
    try {
        TableSchema schema = cliService.getResultSetMetadata(new OperationHandle(req.getOperationHandle()));
        resp.setSchema(schema.toTTableSchema());
        resp.setStatus(OK_STATUS);
    } catch (Exception e) {
        LOG.error("Failed to get result set metadata [request: {}]", req, e);
        resp.setStatus(HiveSQLException.toTStatus(e));
    }
    return resp;
}
Also used : TableSchema(org.apache.hive.service.cli.TableSchema) TGetResultSetMetadataResp(org.apache.hive.service.rpc.thrift.TGetResultSetMetadataResp) 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 73 with OperationHandle

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

the class ThriftCLIService method GetCrossReference.

@Override
public TGetCrossReferenceResp GetCrossReference(TGetCrossReferenceReq req) throws TException {
    TGetCrossReferenceResp resp = new TGetCrossReferenceResp();
    try {
        OperationHandle opHandle = cliService.getCrossReference(new SessionHandle(req.getSessionHandle()), req.getParentCatalogName(), req.getParentSchemaName(), req.getParentTableName(), req.getForeignCatalogName(), req.getForeignSchemaName(), req.getForeignTableName());
        resp.setOperationHandle(opHandle.toTOperationHandle());
        resp.setStatus(OK_STATUS);
    } catch (Exception e) {
        LOG.error("Failed to get cross reference [request: {}]", req, e);
        resp.setStatus(HiveSQLException.toTStatus(e));
    }
    return resp;
}
Also used : TGetCrossReferenceResp(org.apache.hive.service.rpc.thrift.TGetCrossReferenceResp) 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 74 with OperationHandle

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

the class ThriftCLIService method GetTables.

@Override
public TGetTablesResp GetTables(TGetTablesReq req) throws TException {
    TGetTablesResp resp = new TGetTablesResp();
    try {
        OperationHandle opHandle = cliService.getTables(new SessionHandle(req.getSessionHandle()), req.getCatalogName(), req.getSchemaName(), req.getTableName(), req.getTableTypes());
        resp.setOperationHandle(opHandle.toTOperationHandle());
        resp.setStatus(OK_STATUS);
    } catch (Exception e) {
        LOG.error("Failed to get tables [request: {}]", req, e);
        resp.setStatus(HiveSQLException.toTStatus(e));
    }
    return resp;
}
Also used : TGetTablesResp(org.apache.hive.service.rpc.thrift.TGetTablesResp) 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 75 with OperationHandle

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

the class ThriftCLIService method CloseOperation.

@Override
public TCloseOperationResp CloseOperation(TCloseOperationReq req) throws TException {
    TCloseOperationResp resp = new TCloseOperationResp();
    try {
        cliService.closeOperation(new OperationHandle(req.getOperationHandle()));
        resp.setStatus(OK_STATUS);
    } catch (Exception e) {
        LOG.error("Failed to close operation [request: {}]", req, e);
        resp.setStatus(HiveSQLException.toTStatus(e));
    }
    return resp;
}
Also used : TCloseOperationResp(org.apache.hive.service.rpc.thrift.TCloseOperationResp) 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)

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