private HiveLockMode getWriteEntityLockMode (WriteEntity we) {
    HiveLockMode lockMode = we.isComplete() ? HiveLockMode.EXCLUSIVE : HiveLockMode.SHARED;
    //but the writeEntity is complete in DDL operations, instead DDL sets the writeType, so
    //we use it to determine its lockMode, and first we check if the writeType was set
    WriteEntity.WriteType writeType = we.getWriteType();
    if (writeType == null) {
      return lockMode;
    }
    switch (writeType) {
      case DDL_EXCLUSIVE:
        return HiveLockMode.EXCLUSIVE;
      case DDL_SHARED:
        return HiveLockMode.SHARED;
      case DDL_NO_LOCK:
        return null;
      default: //other writeTypes related to DMLs
        return lockMode;
    }
  }
Dedup the list of lock objects so that there is only one lock per table/partition.
If there is both a shared and exclusive lock for the same object, this will deduped
to just a single exclusive lock.  Package level so that the unit tests
can access it.  Not intended for use outside this class.
@param lockObjects
ql/src/java/org/apache/hadoop/hive/ql/lockmgr/DummyTxnManager.java