code: private void setDelegationToken(String delegationTokenStr) throws HiveSQLException {
      this.delegationTokenStr = delegationTokenStr;
      if (delegationTokenStr != null) {
        getHiveConf().set("hive.metastore.token.signature", HS2TOKEN);
        try {
          Utils.setTokenStr(sessionUgi, delegationTokenStr, HS2TOKEN);
        } catch (IOException e) {
          throw new HiveSQLException("Couldn't setup delegation token in the ugi", e);
        }
      }
    }
docs: Enable delegation token for the session
  save the token string and set the token.signature in hive conf. The metastore client uses
  this token.signature to determine where to use kerberos or delegation token
  @throws HiveException
  @throws IOException