private void configureSession(Map<String, String> sessionConfMap) throws HiveSQLException {
    SessionState.setCurrentSessionState(sessionState);
    for (Map.Entry<String, String> entry : sessionConfMap.entrySet()) {
      String key = entry.getKey();
      if (key.startsWith("set:")) {
        try {
          SetProcessor.setVariable(key.substring(4), entry.getValue());
        } catch (Exception e) {
          throw new HiveSQLException(e);
        }
      } else if (key.startsWith("use:")) {
        try {
          if (!(StringUtils.equals(DEFAULT_DATABASE_NAME, entry.getValue()))
              && sessionHive.getDatabase(entry.getValue()) == null) {
            throw new HiveSQLException("Database " + entry.getValue() + " does not exist");
          }
        } catch (HiveException e) {
          throw new HiveSQLException(e);
        }
        SessionState.get().setCurrentDatabase(entry.getValue());
      } else {
        sessionConf.verifyAndSet(key, entry.getValue());
      }
    }
  }
Sets sessionHive object created based on sessionConf.
@throws HiveSQLException
service/src/java/org/apache/hive/service/cli/session/HiveSessionImpl.java