Search in sources :

Example 1 with TSetClientInfoReq

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

the class ThriftCLIServiceClient method setApplicationName.

@Override
public void setApplicationName(SessionHandle sh, String value) throws HiveSQLException {
    try {
        TSetClientInfoReq req = new TSetClientInfoReq(sh.toTSessionHandle());
        req.putToConfiguration("ApplicationName", value);
        TSetClientInfoResp resp = cliService.SetClientInfo(req);
        checkStatus(resp.getStatus());
    } catch (TException e) {
        throw new HiveSQLException(e);
    }
}
Also used : TException(org.apache.thrift.TException) HiveSQLException(org.apache.hive.service.cli.HiveSQLException) TSetClientInfoResp(org.apache.hive.service.rpc.thrift.TSetClientInfoResp) TSetClientInfoReq(org.apache.hive.service.rpc.thrift.TSetClientInfoReq)

Example 2 with TSetClientInfoReq

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

the class HiveConnection method sendClientInfo.

private void sendClientInfo() throws SQLClientInfoException {
    TSetClientInfoReq req = new TSetClientInfoReq(sessHandle);
    Map<String, String> map = new HashMap<>();
    if (clientInfo != null) {
        for (Entry<Object, Object> e : clientInfo.entrySet()) {
            if (e.getKey() == null || e.getValue() == null)
                continue;
            map.put(e.getKey().toString(), e.getValue().toString());
        }
    }
    req.setConfiguration(map);
    try {
        TSetClientInfoResp openResp = client.SetClientInfo(req);
        Utils.verifySuccess(openResp.getStatus());
    } catch (TException | SQLException e) {
        LOG.error("Error sending client info", e);
        throw new SQLClientInfoException("Error sending client info", null, e);
    }
}
Also used : TException(org.apache.thrift.TException) SQLClientInfoException(java.sql.SQLClientInfoException) HashMap(java.util.HashMap) SQLException(java.sql.SQLException) TSetClientInfoResp(org.apache.hive.service.rpc.thrift.TSetClientInfoResp) TSetClientInfoReq(org.apache.hive.service.rpc.thrift.TSetClientInfoReq)

Aggregations

TSetClientInfoReq (org.apache.hive.service.rpc.thrift.TSetClientInfoReq)2 TSetClientInfoResp (org.apache.hive.service.rpc.thrift.TSetClientInfoResp)2 TException (org.apache.thrift.TException)2 SQLClientInfoException (java.sql.SQLClientInfoException)1 SQLException (java.sql.SQLException)1 HashMap (java.util.HashMap)1 HiveSQLException (org.apache.hive.service.cli.HiveSQLException)1