public static Task<MoveWork> findMoveTaskForFsopOutput(List<Task<MoveWork>> mvTasks, Path fsopFinalDir,
      boolean isMmFsop, boolean isDirectInsert, String fsoMoveTaskId, AcidUtils.Operation acidOperation) {
    // find the move task
    for (Task<MoveWork> mvTsk : mvTasks) {
      MoveWork mvWork = mvTsk.getWork();
      Path srcDir = null;
      boolean isLfd = false;
      String moveTaskId = null;
      AcidUtils.Operation moveTaskWriteType = null;
      if (mvWork.getLoadFileWork() != null) {
        srcDir = mvWork.getLoadFileWork().getSourcePath();
        isLfd = true;
        if (isMmFsop || isDirectInsert) {
          srcDir = srcDir.getParent();
        }
        moveTaskId = mvWork.getLoadFileWork().getMoveTaskId();
        moveTaskWriteType = mvWork.getLoadFileWork().getWriteType();
      } else if (mvWork.getLoadTableWork() != null) {
        srcDir = mvWork.getLoadTableWork().getSourcePath();
        moveTaskId = mvWork.getLoadTableWork().getMoveTaskId();
        moveTaskWriteType = mvWork.getLoadTableWork().getWriteType();
      }
      if (Utilities.FILE_OP_LOGGER.isTraceEnabled()) {
        Utilities.FILE_OP_LOGGER.trace("Observing MoveWork " + System.identityHashCode(mvWork)
          + " with " + srcDir + "(from " + (isLfd ? "LFD" : "LTD") + ") while looking for "
          + fsopFinalDir + "(mm = " + isMmFsop + ")");
      }

      if ((srcDir != null) && srcDir.equals(fsopFinalDir)) {
        if (isDirectInsert || isMmFsop) {
          if (moveTaskId.equals(fsoMoveTaskId)) {
            // If the ACID direct insert is on, the MoveTasks cannot be identified by the srcDir as
            // in this case the srcDir is always the root directory of the table.
            // We need to consider the ACID write type to identify the MoveTasks.
            return mvTsk;
          }
        } else {
          return mvTsk;
        }
      }
    }
    return null;
  }
check if it is skewed table and stored as dirs.

@param fsInputDesc
@return
ql/src/java/org/apache/hadoop/hive/ql/optimizer/GenMapRedUtils.java