Source:
<code>private void addUniqueConstraints(List<SQLUniqueConstraint> uks, boolean retrieveCD) throws InvalidObjectException, MetaException { List<MConstraint> cstrs = new ArrayList<MConstraint>(); String constraintName = null; for (int i = 0; i < uks.size(); i++) { AttachedMTableInfo nParentTable = <START> getMTable(uks.get(i).getTable_db(), uks.get(i).getTable_name(), retrieveCD); <END> MTable parentTable = nParentTable.mtbl; if (parentTable == null) { throw new InvalidObjectException("Parent table not found: " + uks.get(i).getTable_name()); } MColumnDescriptor parentCD = retrieveCD ? nParentTable.mcd : parentTable.getSd().getCD(); int parentIntegerIndex = getColumnIndexFromTableColumns(parentCD == null ? null : parentCD.getCols(), uks.get(i).getColumn_name()); if (parentIntegerIndex == -1) { throw new InvalidObjectException("Parent column not found: " + uks.get(i).getColumn_name()); } if (uks.get(i).getUk_name() == null) { if (uks.get(i).getKey_seq() == 1) { constraintName = generateConstraintName(uks.get(i).getTable_db(), uks.get(i).getTable_name(), uks.get(i).getColumn_name(), "uk"); } } else { constraintName = uks.get(i).getUk_name(); } int enableValidateRely = (uks.get(i).isEnable_cstr() ? 4 : 0) + (uks.get(i).isValidate_cstr() ? 2 : 0) + (uks.get(i).isRely_cstr() ? 1 : 0); MConstraint muk = new MConstraint( constraintName, MConstraint.UNIQUE_CONSTRAINT, uks.get(i).getKey_seq(), null, null, enableValidateRely, parentTable, null, parentCD, null, null, parentIntegerIndex); cstrs.add(muk); } pm.makePersistentAll(cstrs); }</code><technical_language>HiveStringUtils.normalizeIdentifier(db_name)</technical_language>

Target:
private void addUniqueConstraints(List<SQLUniqueConstraint> uks, boolean retrieveCD) throws InvalidObjectException, MetaException { List<MConstraint> cstrs = new ArrayList<MConstraint>(); String constraintName = null; for (int i = 0; i < uks.size(); i++) { final String tableDB = HiveStringUtils.normalizeIdentifier(uks.get(i).getTable_db()); final String tableName = HiveStringUtils.normalizeIdentifier(uks.get(i).getTable_name()); final String columnName = HiveStringUtils.normalizeIdentifier(uks.get(i).getColumn_name()); AttachedMTableInfo nParentTable = getMTable(tableDB, tableName, retrieveCD); MTable parentTable = nParentTable.mtbl; if (parentTable == null) { throw new InvalidObjectException("Parent table not found: " + tableName); } MColumnDescriptor parentCD = retrieveCD ? nParentTable.mcd : parentTable.getSd().getCD(); int parentIntegerIndex = getColumnIndexFromTableColumns(parentCD == null ? null : parentCD.getCols(), columnName); if (parentIntegerIndex == -1) { throw new InvalidObjectException("Parent column not found: " + columnName); } if (uks.get(i).getUk_name() == null) { if (uks.get(i).getKey_seq() == 1) { constraintName = generateConstraintName(tableDB, tableName, columnName, "uk"); } } else { constraintName = HiveStringUtils.normalizeIdentifier(uks.get(i).getUk_name()); } int enableValidateRely = (uks.get(i).isEnable_cstr() ? 4 : 0) + (uks.get(i).isValidate_cstr() ? 2 : 0) + (uks.get(i).isRely_cstr() ? 1 : 0); MConstraint muk = new MConstraint( constraintName, MConstraint.UNIQUE_CONSTRAINT, uks.get(i).getKey_seq(), null, null, enableValidateRely, parentTable, null, parentCD, null, null, parentIntegerIndex); cstrs.add(muk); } pm.makePersistentAll(cstrs); }