diff --git a/service/src/java/org/apache/hive/service/cli/thrift/ThriftCLIService.java b/service/src/java/org/apache/hive/service/cli/thrift/ThriftCLIService.java index 8f13fb3cca..492e9e7650 100644 --- a/service/src/java/org/apache/hive/service/cli/thrift/ThriftCLIService.java +++ b/service/src/java/org/apache/hive/service/cli/thrift/ThriftCLIService.java @@ -28,7 +28,7 @@ import java.io.IOException; import java.net.InetAddress; import java.net.UnknownHostException; -import java.util.HashMap; +import java.util.Collections; import java.util.Map; import java.util.concurrent.TimeUnit; import javax.security.auth.login.LoginException; @@ -321,17 +321,15 @@ public TOpenSessionResp OpenSession(TOpenSessionReq req) throws TException { LOG.info("Client protocol version: " + req.getClient_protocol()); TOpenSessionResp resp = new TOpenSessionResp(); try { - SessionHandle sessionHandle = getSessionHandle(req, resp); + final SessionHandle sessionHandle = getSessionHandle(req, resp); + final HiveConf sessionConf = cliService.getSessionConf(sessionHandle); + + final String fetchSizeStr = + Integer.toString(sessionConf.getIntVar(HiveConf.ConfVars.HIVE_SERVER2_THRIFT_RESULTSET_DEFAULT_FETCH_SIZE)); + resp.setSessionHandle(sessionHandle.toTSessionHandle()); - Map configurationMap = new HashMap(); - // Set the updated fetch size from the server into the configuration map for the client - HiveConf sessionConf = cliService.getSessionConf(sessionHandle); - configurationMap.put( - HiveConf.ConfVars.HIVE_SERVER2_THRIFT_RESULTSET_DEFAULT_FETCH_SIZE.varname, - Integer.toString(sessionConf != null ? - sessionConf.getIntVar(HiveConf.ConfVars.HIVE_SERVER2_THRIFT_RESULTSET_DEFAULT_FETCH_SIZE) : - hiveConf.getIntVar(HiveConf.ConfVars.HIVE_SERVER2_THRIFT_RESULTSET_DEFAULT_FETCH_SIZE))); - resp.setConfiguration(configurationMap); + resp.setConfiguration(Collections + .singletonMap(HiveConf.ConfVars.HIVE_SERVER2_THRIFT_RESULTSET_DEFAULT_FETCH_SIZE.varname, fetchSizeStr)); resp.setStatus(OK_STATUS); ThriftCLIServerContext context = (ThriftCLIServerContext)currentServerContext.get();