private static void moveSpecifiedFilesInParallel(FileSystem fs,
      Path src, Path dst, Set<String> filesToMove, List<Future<Void>> futures,
      ExecutorService pool) throws IOException {
    if (!fs.exists(dst)) {
      LOG.info("Creating {}", dst);
      fs.mkdirs(dst);
    }

    FileStatus[] files = fs.listStatus(src);
    for (FileStatus fileStatus : files) {
      if (filesToMove.contains(fileStatus.getPath().toString())) {
        futures.add(pool.submit(new Callable<Void>() {
          @Override
          public Void call() throws HiveException {
            try {
              LOG.debug("Moving from {} to {} ", fileStatus.getPath(), dst);
              Utilities.moveFileOrDir(fs, fileStatus, dst);
            } catch (Exception e) {
              throw new HiveException(e);
            }
            return null;
          }
        }));
      } else if (fileStatus.isDir()) {
        // Traverse directory contents.
        // Directory nesting for dst needs to match src.
        Path nestedDstPath = new Path(dst, fileStatus.getPath().getName());
        moveSpecifiedFilesInParallel(fs, fileStatus.getPath(), nestedDstPath,
            filesToMove, futures, pool);
      }
    }
  }
Moves files from src to dst if it is within the specified set of paths
@param fs
@param src
@param dst
@param filesToMove
@param futures List of futures
@param pool thread pool
@throws IOException
ql/src/java/org/apache/hadoop/hive/ql/exec/Utilities.java