use of org.apache.hive.service.rpc.thrift.TSetClientInfoResp 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);
}
}
use of org.apache.hive.service.rpc.thrift.TSetClientInfoResp 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);
}
}
use of org.apache.hive.service.rpc.thrift.TSetClientInfoResp in project hive by apache.
the class ThriftCLIService method SetClientInfo.
@Override
public TSetClientInfoResp SetClientInfo(TSetClientInfoReq req) throws TException {
// TODO: We don't do anything for now, just log this for debugging.
// We may be able to make use of this later, e.g. for workload management.
TSetClientInfoResp resp = null;
if (req.isSetConfiguration()) {
StringBuilder sb = null;
SessionHandle sh = null;
for (Map.Entry<String, String> e : req.getConfiguration().entrySet()) {
if (sb == null) {
sh = new SessionHandle(req.getSessionHandle());
sb = new StringBuilder("Client information for ").append(sh).append(": ");
} else {
sb.append(", ");
}
sb.append(e.getKey()).append(" = ").append(e.getValue());
if ("ApplicationName".equals(e.getKey())) {
try {
cliService.setApplicationName(sh, e.getValue());
} catch (Exception ex) {
LOG.warn("Error setting application name", ex);
resp = new TSetClientInfoResp(HiveSQLException.toTStatus(ex));
}
}
}
if (sb != null) {
LOG.info("{}", sb);
}
}
return resp == null ? new TSetClientInfoResp(OK_STATUS) : resp;
}
Aggregations