code: List<CopyableFile.Builder> getCopyableFilesFromPaths(Collection<FileStatus> paths,
        CopyConfiguration configuration, Optional<Partition> partition) throws IOException {
      List<CopyableFile.Builder> builders = Lists.newArrayList();
      List<SourceAndDestination> dataFiles = Lists.newArrayList();
  
      Configuration hadoopConfiguration = new Configuration();
      FileSystem actualSourceFs = null;
      String referenceScheme = null;
      String referenceAuthority = null;
  
      for (FileStatus status : paths) {
        dataFiles.add(new SourceAndDestination(status, getTargetPathHelper().getTargetPath(status.getPath(), this.targetFs, partition, true)));
      }
  
      for (SourceAndDestination sourceAndDestination : dataFiles) {
  
        URI uri = sourceAndDestination.getSource().getPath().toUri();
        if (actualSourceFs == null || !StringUtils.equals(referenceScheme, uri.getScheme())
            || !StringUtils.equals(referenceAuthority, uri.getAuthority())) {
          actualSourceFs = sourceAndDestination.getSource().getPath().getFileSystem(hadoopConfiguration);
          referenceScheme = uri.getScheme();
          referenceAuthority = uri.getAuthority();
        }
  
        if (!this.dataset.getTableRootPath().isPresent()) {
          // The logic for computing ancestor owner and permissions for hive copies depends on tables having a non-glob
          // location. Currently, this restriction is also imposed by Hive, so this is not a problem. If this ever changes
          // on the Hive side, and we try to copy a table with a glob location, this logic will have to change.
          throw new IOException(String.format("Table %s does not have a concrete table root path.",
              this.dataset.getTable().getCompleteName()));
        }
        List<OwnerAndPermission> ancestorOwnerAndPermission =
            CopyableFile.resolveReplicatedOwnerAndPermissionsRecursively(actualSourceFs,
                sourceAndDestination.getSource().getPath().getParent(), this.dataset.getTableRootPath().get().getParent(), configuration);
  
        builders.add(CopyableFile.fromOriginAndDestination(actualSourceFs, sourceAndDestination.getSource(),
            sourceAndDestination.getDestination(), configuration).
            ancestorsOwnerAndPermission(ancestorOwnerAndPermission));
      }
  
      return builders;
    }
docs: Get builders for a {@link CopyableFile} for each file referred to by a {@link org.apache.hadoop.hive.metastore.api.StorageDescriptor}.