private void basicMetadataSummary(Table table, MetadataTableSummary metaSummary) {
    Map<String, String> summary = table.currentSnapshot().summary();
    metaSummary.setNumRows(Long.parseLong(summary.getOrDefault(SnapshotSummary.TOTAL_RECORDS_PROP, "0")));
    metaSummary.setTotalSize(Long.parseLong(summary.getOrDefault(SnapshotSummary.TOTAL_FILE_SIZE_PROP, "0")));
    metaSummary.setPartitionColumnCount(table.spec().fields().size());
    metaSummary.setNumFiles(Long.parseLong(summary.getOrDefault(SnapshotSummary.TOTAL_DATA_FILES_PROP, "0")));
    List<Types.NestedField> columns = table.schema().columns();
    metaSummary.columnSummary(columns.size(),
        (int) columns.stream().filter(col -> col.type().isListType()).count(),
        (int) columns.stream().filter(col -> col.type().isStructType()).count(),
        (int) columns.stream().filter(col -> col.type().isMapType()).count());

    if (table.spec().isPartitioned()) {
      PartitionsTable partitionsTable =
          (PartitionsTable) MetadataTableUtils.createMetadataTableInstance(table, MetadataTableType.PARTITIONS);
      try (CloseableIterable<FileScanTask> iterable = partitionsTable.newScan().planFiles()) {
        long partitionCount = 0;
        for (FileScanTask fileScanTask : iterable) {
          partitionCount += fileScanTask.file().recordCount();
        }
        metaSummary.setPartitionCount((int) partitionCount);
      } catch (Exception e) {
        LOG.warn("Error listing the partitions in table: " + table.name(), e);
        metaSummary.setPartitionCount(0);
      }
    }
  }
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