Search in sources :

Example 1 with TGetTableTypesResp

use of org.apache.hive.service.rpc.thrift.TGetTableTypesResp in project hive by apache.

the class HiveDatabaseMetaData method getTableTypes.

public ResultSet getTableTypes() throws SQLException {
    TGetTableTypesResp tableTypeResp;
    try {
        tableTypeResp = client.GetTableTypes(new TGetTableTypesReq(sessHandle));
    } catch (TException e) {
        throw new SQLException(e.getMessage(), "08S01", e);
    }
    Utils.verifySuccess(tableTypeResp.getStatus());
    return new HiveQueryResultSet.Builder(connection).setClient(client).setStmtHandle(tableTypeResp.getOperationHandle()).build();
}
Also used : TException(org.apache.thrift.TException) SQLException(java.sql.SQLException) TGetTableTypesResp(org.apache.hive.service.rpc.thrift.TGetTableTypesResp) TGetTableTypesReq(org.apache.hive.service.rpc.thrift.TGetTableTypesReq)

Example 2 with TGetTableTypesResp

use of org.apache.hive.service.rpc.thrift.TGetTableTypesResp 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.error("Failed to get table types [request: {}]", req, 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) 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 3 with TGetTableTypesResp

use of org.apache.hive.service.rpc.thrift.TGetTableTypesResp in project hive by apache.

the class ThriftCLIServiceClient method getTableTypes.

/* (non-Javadoc)
   * @see org.apache.hive.service.cli.ICLIService#getTableTypes(org.apache.hive.service.cli.SessionHandle)
   */
@Override
public OperationHandle getTableTypes(SessionHandle sessionHandle) throws HiveSQLException {
    try {
        TGetTableTypesReq req = new TGetTableTypesReq(sessionHandle.toTSessionHandle());
        TGetTableTypesResp resp = cliService.GetTableTypes(req);
        checkStatus(resp.getStatus());
        TProtocolVersion protocol = sessionHandle.getProtocolVersion();
        return new OperationHandle(resp.getOperationHandle(), protocol);
    } catch (HiveSQLException e) {
        throw e;
    } catch (Exception e) {
        throw new HiveSQLException(e);
    }
}
Also used : TProtocolVersion(org.apache.hive.service.rpc.thrift.TProtocolVersion) HiveSQLException(org.apache.hive.service.cli.HiveSQLException) TGetTableTypesResp(org.apache.hive.service.rpc.thrift.TGetTableTypesResp) TOperationHandle(org.apache.hive.service.rpc.thrift.TOperationHandle) OperationHandle(org.apache.hive.service.cli.OperationHandle) TGetTableTypesReq(org.apache.hive.service.rpc.thrift.TGetTableTypesReq) HiveSQLException(org.apache.hive.service.cli.HiveSQLException) TException(org.apache.thrift.TException)

Aggregations

TGetTableTypesResp (org.apache.hive.service.rpc.thrift.TGetTableTypesResp)3 TException (org.apache.thrift.TException)3 HiveSQLException (org.apache.hive.service.cli.HiveSQLException)2 OperationHandle (org.apache.hive.service.cli.OperationHandle)2 TGetTableTypesReq (org.apache.hive.service.rpc.thrift.TGetTableTypesReq)2 IOException (java.io.IOException)1 UnknownHostException (java.net.UnknownHostException)1 SQLException (java.sql.SQLException)1 LoginException (javax.security.auth.login.LoginException)1 ServiceException (org.apache.hive.service.ServiceException)1 SessionHandle (org.apache.hive.service.cli.SessionHandle)1 TOperationHandle (org.apache.hive.service.rpc.thrift.TOperationHandle)1 TProtocolVersion (org.apache.hive.service.rpc.thrift.TProtocolVersion)1