private static List<DataFile> getDataFiles(RemoteIterator<LocatedFileStatus> fileStatusIterator,
      Map<String, String> partitionKeys, String format, PartitionSpec spec, MetricsConfig metricsConfig,
      NameMapping nameMapping, Configuration conf) throws IOException {
    List<DataFile> dataFiles = Lists.newArrayList();
    while (fileStatusIterator.hasNext()) {
      LocatedFileStatus fileStatus = fileStatusIterator.next();
      String fileName = fileStatus.getPath().getName();
      if (fileName.startsWith(".") || fileName.startsWith("_") || fileName.endsWith("metadata.json")) {
        continue;
      }
      partitionKeys.replaceAll((key, value) -> FileUtils.escapePathName(value));

      int[] stringFields = IntStream.range(0, spec.javaClasses().length)
        .filter(i -> spec.javaClasses()[i].isAssignableFrom(String.class)).toArray();

      dataFiles.addAll(Lists.transform(
          TableMigrationUtil.listPartition(partitionKeys, fileStatus.getPath().toString(), format, spec,
            conf, metricsConfig, nameMapping),
          dataFile -> {
            StructLike structLike = dataFile.partition();
            for (int pos : stringFields) {
              structLike.set(pos, FileUtils.unescapePathName(structLike.get(pos, String.class)));
            }
            return dataFile;
          }));
    }
    return dataFiles;
  }
Import files from given partitions to an Iceberg table.
@param sourceLocation location of the HMS table
@param format inputformat class name of the HMS table
@param partitionSpecProxy  list of HMS table partitions wrapped in partitionSpecProxy
@param partitionKeys list of partition keys
@param icebergTableProperties destination iceberg table properties
@param conf a Hadoop configuration
iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/HiveTableUtil.java