public static void removeQueryId(
      Map<Long, Set<Long>> statementIdToQueryId, Long statementId, Long queryId) {
    if (statementId == null) {
      statementIdToQueryId.forEach(
          (k, v) -> {
            if (v != null) {
              v.remove(queryId);
            }
          });
    } else {
      Set<Long> queryIds = statementIdToQueryId.get(statementId);
      if (queryIds != null) {
        queryIds.remove(queryId);
      }
    }
  }
Client Session is the only identity for a connection.
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/session/ClientSession.java