private void clearInternalTableContentsFiles(
      long lastTime,
      Set<String> exclude,
      TableOrphanFilesCleaningMetrics orphanFilesCleaningMetrics) {
    String dataLocation = table.location() + File.separator + DATA_FOLDER_NAME;
    int expected = 0, deleted = 0;

    try (AuthenticatedFileIO io = fileIO()) {
      // listPrefix will not return the directory and the orphan file clean should clean the empty
      // dir.
      if (io.supportFileSystemOperations()) {
        SupportsFileSystemOperations fio = io.asFileSystemIO();
        Set<PathInfo> directories = new HashSet<>();
        Set<String> filesToDelete =
            deleteInvalidFilesInFs(fio, dataLocation, lastTime, exclude, directories);
        expected = filesToDelete.size();
        deleted = TableFileUtil.deleteFiles(io, filesToDelete);
        /* delete empty directories */
        deleteEmptyDirectories(fio, directories, lastTime, exclude);
      } else if (io.supportPrefixOperations()) {
        SupportsPrefixOperations pio = io.asPrefixFileIO();
        Set<String> filesToDelete =
            deleteInvalidFilesByPrefix(pio, dataLocation, lastTime, exclude);
        expected = filesToDelete.size();
        deleted = TableFileUtil.deleteFiles(io, filesToDelete);
      } else {
        LOG.warn(
            String.format(
                "Table %s doesn't support a fileIo with listDirectory or listPrefix, so skip clear files.",
                table.name()));
      }
    }

    final int finalExpected = expected;
    final int finalDeleted = deleted;
    runWithCondition(
        expected > 0,
        () -> {
          LOG.info(
              "Deleted {}/{} orphan content files for table {}",
              finalDeleted,
              finalExpected,
              table.name());
          orphanFilesCleaningMetrics.completeOrphanDataFiles(finalExpected, finalDeleted);
        });
  }
Purge data older than the specified UTC timestamp

@param expirationConfig expiration configs
@param instant timestamp/timestampz/long field type uses UTC, others will use the local time
    zone
amoro-ams/src/main/java/org/apache/amoro/server/optimizing/maintainer/IcebergTableMaintainer.java