@Override
  public void getMetaSummary(Table table, MetadataTableSummary metaSummary) {
    basicMetadataSummary(table, metaSummary);
    SummaryMapBuilder builder = new SummaryMapBuilder();
    Table metadataEntries = MetadataTableUtils
        .createMetadataTableInstance(table, MetadataTableType.METADATA_LOG_ENTRIES);
    try (CloseableIterable<ScanTask> iterable = metadataEntries.newBatchScan().planFiles()) {
      List<?> files = Lists.newArrayList(CloseableIterable.transform(iterable,
          t -> ((FileScanTask) t).file()));
      builder.add(NUM_METADATA_FILES, files.size());
    } catch (IOException e) {
      LOG.warn("Error while listing the metadata files, table: " + table.name(), e);
      builder.add(NUM_METADATA_FILES, 1);
    }
    int numManifests = 0;
    long manifestsSize = 0;
    if (table.currentSnapshot() != null) {
      List<ManifestFile> manifests = table.currentSnapshot().allManifests(table.io());
      numManifests = manifests.size();
      manifestsSize = manifests.stream().map(ManifestFile::length).mapToLong(Long::longValue).sum();
    }

    branchOrTagSummary(table, builder);
    Map<String, String> properties = table.properties();
    builder
        .add(NUM_SNAPSHOTS, Integer.parseInt(properties.getOrDefault(SNAPSHOT_COUNT,
            "" + IteratorUtils.size(table.snapshots().iterator()))))
        .add(NUM_MANIFESTS, numManifests)
        .add(MANIFESTS_SIZE, manifestsSize)
        .add(SNAPSHOT_MAX_AGE,
            Long.parseLong(properties.getOrDefault("history.expire.max-snapshot-age-ms", "-1")))
        .add(SNAPSHOT_MIN_KEEP,
            Long.parseLong(properties.getOrDefault("history.expire.min-snapshots-to-keep", "-1")));
    if (formatJson) {
      metaSummary.addExtra("metadata", builder);
    } else {
      metaSummary.addExtra(builder);
    }
  }
Collect the metadata summary for the table, like the number of snapshots, data files
or the partition count.
iceberg/iceberg-handler/src/main/java/org/apache/iceberg/metasummary/MetadataSummary.java