private void cleanMergeTaskInputFiles(List<JobContext> jobContexts, ExecutorService fileExecutor) throws IOException {
    // Merge task has merged several files into one. Hence we need to remove the stale files.
    // At this stage the file is written and task-committed, but the old files are still present.
    Stream<Path> mergedPaths = jobContexts.stream()
        .map(JobContext::getJobConf)
        .filter(jobConf -> jobConf.getInputFormat().getClass().isAssignableFrom(CombineHiveInputFormat.class))
        .map(Utilities::getMapWork).filter(Objects::nonNull)
        .map(MapWork::getInputPaths).filter(Objects::nonNull)
        .flatMap(List::stream);

    Tasks.foreach(mergedPaths)
        .retry(3)
        .executeWith(fileExecutor)
        .run(path -> {
          FileSystem fs = path.getFileSystem(jobContexts.get(0).getJobConf());
          if (fs.exists(path)) {
            fs.delete(path, true);
          }
        }, IOException.class);
  }
Generates a list of ContentFile objects of the output files in the jobContexts.
@param jobContexts List of jobContexts
@return Returns the list of file statuses of the output files in the jobContexts
@throws IOException Throws IOException
iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/HiveIcebergOutputCommitter.java