public static HiveLockObject createFrom(Hive hiveDB, String tableName,
      Map<String, String> partSpec) throws HiveException {
    Table  tbl = hiveDB.getTable(tableName);
    if (tbl == null) {
      throw new HiveException("Table " + tableName + " does not exist ");
    }

    HiveLockObject obj = null;

    if  (partSpec == null) {
      obj = new HiveLockObject(tbl, null);
    }
    else {
      Partition par = hiveDB.getPartition(tbl, partSpec, false);
      if (par == null) {
        throw new HiveException("Partition " + partSpec + " for table " +
            tableName + " does not exist");
      }
      obj = new HiveLockObject(par, null);
    }
    return obj;
  }
Creates a locking object for a table (when partition spec is not provided)
or a table partition
@param hiveDB    an object to communicate with the metastore
@param tableName the table to create the locking object on
@param partSpec  the spec of a partition to create the locking object on
@return  the locking object
@throws HiveException
ql/src/java/org/apache/hadoop/hive/ql/lockmgr/HiveLockObject.java