Search in sources :

Example 1 with TGetInfoResp

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

the class HiveDatabaseMetaData method getServerInfo.

private TGetInfoResp getServerInfo(TGetInfoType type) throws SQLException {
    TGetInfoReq req = new TGetInfoReq(sessHandle, type);
    TGetInfoResp resp;
    try {
        resp = client.GetInfo(req);
    } catch (TException e) {
        throw new SQLException(e.getMessage(), "08S01", e);
    }
    Utils.verifySuccess(resp.getStatus());
    return resp;
}
Also used : TGetInfoReq(org.apache.hive.service.rpc.thrift.TGetInfoReq) TException(org.apache.thrift.TException) SQLException(java.sql.SQLException) TGetInfoResp(org.apache.hive.service.rpc.thrift.TGetInfoResp)

Example 2 with TGetInfoResp

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

the class HiveDatabaseMetaData method getDatabaseProductVersion.

public String getDatabaseProductVersion() throws SQLException {
    if (dbVersion != null) {
        //lazy-caching of the version.
        return dbVersion;
    }
    TGetInfoResp resp = getServerInfo(GetInfoType.CLI_DBMS_VER.toTGetInfoType());
    this.dbVersion = resp.getInfoValue().getStringValue();
    return dbVersion;
}
Also used : TGetInfoResp(org.apache.hive.service.rpc.thrift.TGetInfoResp)

Example 3 with TGetInfoResp

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

the class ThriftCLIServiceClient method getInfo.

/* (non-Javadoc)
   * @see org.apache.hive.service.cli.ICLIService#getInfo(org.apache.hive.service.cli.SessionHandle, java.util.List)
   */
@Override
public GetInfoValue getInfo(SessionHandle sessionHandle, GetInfoType infoType) throws HiveSQLException {
    try {
        // FIXME extract the right info type
        TGetInfoReq req = new TGetInfoReq(sessionHandle.toTSessionHandle(), infoType.toTGetInfoType());
        TGetInfoResp resp = cliService.GetInfo(req);
        checkStatus(resp.getStatus());
        return new GetInfoValue(resp.getInfoValue());
    } catch (HiveSQLException e) {
        throw e;
    } catch (Exception e) {
        throw new HiveSQLException(e);
    }
}
Also used : TGetInfoReq(org.apache.hive.service.rpc.thrift.TGetInfoReq) GetInfoValue(org.apache.hive.service.cli.GetInfoValue) HiveSQLException(org.apache.hive.service.cli.HiveSQLException) TGetInfoResp(org.apache.hive.service.rpc.thrift.TGetInfoResp) HiveSQLException(org.apache.hive.service.cli.HiveSQLException) TException(org.apache.thrift.TException)

Example 4 with TGetInfoResp

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

the class ThriftCLIService method GetInfo.

@Override
public TGetInfoResp GetInfo(TGetInfoReq req) throws TException {
    TGetInfoResp resp = new TGetInfoResp();
    try {
        GetInfoValue getInfoValue = cliService.getInfo(new SessionHandle(req.getSessionHandle()), GetInfoType.getGetInfoType(req.getInfoType()));
        resp.setInfoValue(getInfoValue.toTGetInfoValue());
        resp.setStatus(OK_STATUS);
    } catch (Exception e) {
        LOG.warn("Error getting info: ", e);
        resp.setStatus(HiveSQLException.toTStatus(e));
    }
    return resp;
}
Also used : GetInfoValue(org.apache.hive.service.cli.GetInfoValue) TGetInfoResp(org.apache.hive.service.rpc.thrift.TGetInfoResp) SessionHandle(org.apache.hive.service.cli.SessionHandle) 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

TGetInfoResp (org.apache.hive.service.rpc.thrift.TGetInfoResp)4 TException (org.apache.thrift.TException)3 GetInfoValue (org.apache.hive.service.cli.GetInfoValue)2 HiveSQLException (org.apache.hive.service.cli.HiveSQLException)2 TGetInfoReq (org.apache.hive.service.rpc.thrift.TGetInfoReq)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