private void collectBasicStats(Map<Long, MetadataTableSummary> summaries, Set<Long> nonPartedTabs,
      Set<Long> partedTabs) throws MetaException {
    String queryText0 = "select \"TBL_ID\", \"PARAM_KEY\", CAST(" + dbType.toVarChar("\"PARAM_VALUE\"") + " AS decimal(21,0)) from \"TABLE_PARAMS\" where \"PARAM_KEY\" " +
        "in ('" + StatsSetupConst.TOTAL_SIZE + "', '" + StatsSetupConst.NUM_FILES + "', '" + StatsSetupConst.ROW_COUNT + "') and \"TBL_ID\" in (";
    runBatched(batchSize, new ArrayList<>(nonPartedTabs), new Batchable<Long, Void>() {
      @Override
      public List<Void> run(List<Long> input) throws Exception {
        collectBasicStats(queryText0, input, summaries, "");
        return Collections.emptyList();
      }
    });

   String queryText1 = "select \"TBL_ID\", \"PARAM_KEY\", sum(CAST(" + dbType.toVarChar("\"PARAM_VALUE\"") + " AS decimal(21,0))) from \"PARTITIONS\" t " +
       "join \"PARTITION_PARAMS\" p on p.\"PART_ID\" = t.\"PART_ID\" where \"PARAM_KEY\" " +
       "in ('" + StatsSetupConst.TOTAL_SIZE + "', '" + StatsSetupConst.NUM_FILES + "', '" + StatsSetupConst.ROW_COUNT + "') and t.\"TBL_ID\" in (";
   runBatched(batchSize, new ArrayList<>(partedTabs), new Batchable<Long, Void>() {
      @Override
      public List<Void> run(List<Long> input) throws Exception {
        collectBasicStats(queryText1, input, summaries, " group by \"TBL_ID\", \"PARAM_KEY\"");
        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