public static void renameOrMoveFilesInParallel(Configuration conf,
      FileSystem fs, Path src, Path dst) throws IOException, HiveException {
    if (!fs.exists(dst)) {
      if (!fs.rename(src, dst)) {
        throw new HiveException("Unable to move: " + src + " to: " + dst);
      }
    } else {
      // move files in parallel
      LOG.info("Moving files from {}  to {}", src, dst);
      final ExecutorService pool = createMoveThreadPool(conf);
      List<Future<Void>> futures = new LinkedList<>();

      final FileStatus[] files = fs.listStatus(src);
      for (FileStatus file : files) {
        futures.add(pool.submit(new Callable<Void>() {
          @Override
          public Void call() throws HiveException {
            try {
              Utilities.moveFileOrDir(fs, file, dst);
            } catch (Exception e) {
              throw new HiveException(e);
            }
            return null;
          }
        }));
      }

      shutdownAndCleanup(pool, futures);
      LOG.info("Rename files from {}  to {} is complete", src, dst);
    }
  }
Rename src to dst, or in the case dst already exists, move files in src
to dst. If there is an existing file with the same name, the new file's
name will be appended with "_1", "_2", etc. Happens in parallel mode.

@param conf

@param fs
         the FileSystem where src and dst are on.
@param src
         the src directory
@param dst
         the target directory
@throws IOException
ql/src/java/org/apache/hadoop/hive/ql/exec/Utilities.java