Map<String, Set<Integer>> queryPartitionNameAndIds(String clusterName) throws SQLException {
    Map<String, Set<Integer>> nameAndIds = new HashMap<>();
    try (Connection connection = dataSource.getConnection()) {
      try (PreparedStatement queryStatement = connection.prepareStatement(queryPartitionIdAndNamesSql)) {
        long startTimeMs = System.currentTimeMillis();
        queryStatement.setString(1, clusterName);
        try (ResultSet resultSet = queryStatement.executeQuery()) {
          while (resultSet.next()) {
            int partitionId = resultSet.getInt(ID_COLUMN);
            String partitionClassName = resultSet.getString(NAME_COLUMN);
            nameAndIds.computeIfAbsent(partitionClassName, k -> new HashSet<>()).add(partitionId);
          }
        }
        metrics.readTimeMs.update(System.currentTimeMillis() - startTimeMs);
        metrics.readSuccessCount.inc();
      }
      return nameAndIds;
    } catch (SQLException e) {
      metrics.readFailureCount.inc();
      logger.error("Failed to execute query {}, with parameter {}", queryPartitionIdAndNamesSql, clusterName, e);
      throw e;
    }
  }
Query partition class names and partitions that belong to certain partition class name for the given {@code clusterName}.
An empty map will be returned if there is no partition names and ids for the given {@code clusterName}.
@param clusterName the clusterName
@return A map whose key is the partition class name and the value is a set of partition ids.
@throws SQLException
ambry-mysql/src/main/java/com/github/ambry/accountstats/PartitionClassReportsDao.java