use of org.apache.hadoop.hive.metastore.api.UniqueConstraintsRequest in project hive by apache.
the class TestUniqueConstraint method inOtherCatalog.
@Test
public void inOtherCatalog() throws TException {
String constraintName = "ocuc";
// Table in non 'hive' catalog
List<SQLUniqueConstraint> uc = new SQLUniqueConstraintBuilder().onTable(testTables[2]).addColumn("col1").setConstraintName(constraintName).build(metaStore.getConf());
client.addUniqueConstraint(uc);
UniqueConstraintsRequest rqst = new UniqueConstraintsRequest(testTables[2].getCatName(), testTables[2].getDbName(), testTables[2].getTableName());
List<SQLUniqueConstraint> fetched = client.getUniqueConstraints(rqst);
Assert.assertEquals(uc, fetched);
client.dropConstraint(testTables[2].getCatName(), testTables[2].getDbName(), testTables[2].getTableName(), constraintName);
rqst = new UniqueConstraintsRequest(testTables[2].getCatName(), testTables[2].getDbName(), testTables[2].getTableName());
fetched = client.getUniqueConstraints(rqst);
Assert.assertTrue(fetched.isEmpty());
}
Aggregations