private void collectColumnSummary(Map<Long, MetadataTableSummary> summaries) throws MetaException {
    String queryText0 = "select \"TBL_ID\", count(*), sum(CASE WHEN \"TYPE_NAME\" like 'array%' THEN 1 ELSE 0 END)," +
        " sum(CASE WHEN \"TYPE_NAME\" like 'struct%' THEN 1 ELSE 0 END), sum(CASE WHEN \"TYPE_NAME\" like 'map%' THEN 1 ELSE 0 END)" +
        " from \"TBLS\" t join \"SDS\" s on t.\"SD_ID\" = s.\"SD_ID\" join \"CDS\" c on s.\"CD_ID\" = c.\"CD_ID\" join \"COLUMNS_V2\" v on c.\"CD_ID\" = v.\"CD_ID\"" +
        " where \"TBL_ID\" in (";
    runBatched(batchSize, new ArrayList<>(summaries.keySet()), new Batchable<Long, Void>() {
      @Override
      public List<Void> run(List<Long> input) throws Exception {
        Pair<Query<?>, List<Object[]>> qResult = getResultFromInput(input, queryText0, " group by \"TBL_ID\"");
        try {
          List<Object[]> result = qResult.getRight();
          if (result != null) {
            for (Object[] fields : result) {
              Deadline.checkTimeout();
              Long tabId = Long.parseLong(String.valueOf(fields[0]));
              MetadataTableSummary summary = summaries.get(tabId);
              summary.columnSummary(Integer.parseInt(fields[1].toString()), Integer.parseInt(fields[2].toString()),
                  Integer.parseInt(fields[3].toString()), Integer.parseInt(fields[4].toString()));
            }
          }
        } finally {
          qResult.getLeft().closeAll();
        }
        return Collections.emptyList();
      }
    });
  }
Using resultSet to read the HMS_SUMMARY table.
@param catalogFilter the optional catalog name filter
@param dbFilter the optional database name filter
@param tableFilter the optional table name filter
@return MetadataSummary
@throws MetaException
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/tools/MetaToolObjectStore.java