private LocalTableLock acquireLockForFileMove(LoadTableDesc loadTableWork) throws HiveException {
    LockFileMoveMode mode = LockFileMoveMode.fromConf(conf);

    if (mode == LockFileMoveMode.NONE) {
      return new LocalTableLock();
    }
    if (mode == LockFileMoveMode.DP && loadTableWork.getDPCtx() == null) {
      return new LocalTableLock();
    }

    WriteEntity output = context.getLoadTableOutputMap().get(loadTableWork);
    List<HiveLockObj> lockObjects = context.getOutputLockObjects().get(output);
    if (lockObjects == null) {
      return new LocalTableLock();
    }
    TableDesc table = loadTableWork.getTable();
    if (table == null) {
      return new LocalTableLock();
    }

    Hive db = getHive();
    Table baseTable = db.getTable(loadTableWork.getTable().getTableName());

    HiveLockObject.HiveLockObjectData lockData =
        new HiveLockObject.HiveLockObjectData(queryPlan.getQueryId(),
                               String.valueOf(System.currentTimeMillis()),
                               "IMPLICIT",
                               queryPlan.getQueryStr(),
                               conf);

    HiveLockObject lock = new HiveLockObject(baseTable, lockData);

    for (HiveLockObj hiveLockObj : lockObjects) {
      if (Arrays.equals(hiveLockObj.getObj().getPaths(), lock.getPaths())) {
        HiveLockMode l = hiveLockObj.getMode();
        if (l == HiveLockMode.EXCLUSIVE || l == HiveLockMode.SEMI_SHARED) {
          // no need to lock ; already owns a more powerful one
          return new LocalTableLock();
        }
      }
    }

    return new LocalTableLock(lock);
  }
so to make sure we crate WriteEntity with the right WriteType.  This is (at this point) only
for consistency since LockManager (which is the only thing that pays attention to WriteType)
has done it's job before the query ran.
ql/src/java/org/apache/hadoop/hive/ql/exec/MoveTask.java