private static boolean shouldRdiff(Path p, Configuration conf, String snapshot, boolean overwriteTarget) throws Exception {
    // Using the configuration in string form since hive-shims doesn't have a dependency on hive-common.
    boolean targetModified = false;
    try {
      DistributedFileSystem dfs = (DistributedFileSystem) p.getFileSystem(conf);
      // Check if the target got modified
      SnapshotDiffReportListing snapshotDiff = dfs.getClient()
          .getSnapshotDiffReportListing(p.toUri().getPath(), snapshot, "", DFSUtilClient.EMPTY_BYTES, -1);

      // If there is even a single entry in these list, we can conclude that the target is modified, and we need to
      // do a reverse diff.
      if (snapshotDiff.getCreateList() != null && !snapshotDiff.getCreateList().isEmpty()) {
        targetModified = true;
      }
      if (snapshotDiff.getModifyList() != null && !snapshotDiff.getModifyList().isEmpty()) {
        targetModified = true;
      }
      if (snapshotDiff.getDeleteList() != null && !snapshotDiff.getDeleteList().isEmpty()) {
        targetModified = true;
      }
    } catch (Exception e) {
      LOG.error("Failed to compute snapshot diff for path: {} and snapshot: {}", p, snapshot);
    }
    if (targetModified && !overwriteTarget) {
      throw new Exception(
          "The target modified during snapshot based data copy for path: " + p + " and snapshot: " + snapshot);
    }
    return targetModified;
  }
Checks wether reverse diff on the snapshot should be performed or not.
@param p path where snapshot exists.
@param conf the hive configuration.
@param snapshot the name of snapshot.
@param overwriteTarget whether overwriting target is enabled.
@return true, if we need to do rdiff.
shims/0.23/src/main/java/org/apache/hadoop/hive/shims/Hadoop23Shims.java