use of org.apache.hive.service.rpc.thrift.TOpenSessionResp in project hive by apache.
the class HiveConnection method openSession.
private void openSession(TOpenSessionReq openReq) throws TException, SQLException {
TOpenSessionResp openResp = client.OpenSession(openReq);
// Populate a given configuration from HS2 server HiveConf, only if that configuration
// is not already present in Connection parameter HiveConf i.e., client side configuration
// takes precedence over the server side configuration.
Map<String, String> serverHiveConf = openResp.getConfiguration();
updateServerHiveConf(serverHiveConf, connParams);
// validate connection
Utils.verifySuccess(openResp.getStatus());
if (!supportedProtocols.contains(openResp.getServerProtocolVersion())) {
throw new TException("Unsupported Hive2 protocol");
}
protocol = openResp.getServerProtocolVersion();
sessHandle = openResp.getSessionHandle();
final String serverFetchSizeString = openResp.getConfiguration().get(ConfVars.HIVE_SERVER2_THRIFT_RESULTSET_DEFAULT_FETCH_SIZE.varname);
if (serverFetchSizeString == null) {
throw new IllegalStateException("Server returned a null default fetch size. Check that " + ConfVars.HIVE_SERVER2_THRIFT_RESULTSET_DEFAULT_FETCH_SIZE.varname + " is configured correctly.");
}
this.defaultFetchSize = Integer.parseInt(serverFetchSizeString);
if (this.defaultFetchSize <= 0) {
throw new IllegalStateException("Default fetch size must be greater than 0");
}
}
Aggregations