Skip to content

Commit

Permalink
HIVE-26537: Deprecate older APIs in the HMS thrift interface (#3599) …
Browse files Browse the repository at this point in the history
…(Sai Hemanth Gantasala, reviewed by Zhihua Deng, Naveen Gangam)
  • Loading branch information
saihemanth-cloudera authored Jul 18, 2024
1 parent b18d573 commit 41c11fb
Show file tree
Hide file tree
Showing 268 changed files with 45,841 additions and 28,692 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,8 @@ public void createDatabase() throws Exception {
String dbLocationUri = testTempDir;
String dbDescription = "no description";
Database db = new Database(dbName, dbDescription, dbLocationUri, emptyParameters);
db.setOwnerName("test_user");
db.setCreateTime(startTime);
msClient.createDatabase(db);

// Read notification from metastore
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,10 @@ public void setUp() throws Exception {
// Create the 'hive' catalog with new warehouse directory
HMSHandler.createDefaultCatalog(rawStore, new Warehouse(conf));
try {
hmsHandler.drop_dataconnector(dcName, true ,true);
DropDataConnectorRequest dropDcReq = new DropDataConnectorRequest(dcName);
dropDcReq.setIfNotExists(true);
dropDcReq.setCheckReferences(true);
hmsHandler.drop_dataconnector_req(dropDcReq);
hmsHandler.drop_table(dbName, tblName, true);
hmsHandler.drop_database(dbName, true, false);
hmsHandler.drop_catalog(new DropCatalogRequest(catalogName));
Expand Down Expand Up @@ -372,7 +375,8 @@ public void testR_CreateDataConnector_unAuthorizedUser() {
UserGroupInformation.setLoginUser(UserGroupInformation.createRemoteUser(unAuthorizedUser));
try {
DataConnector connector = new DataConnector(dcName, "mysql", "jdbc:mysql://localhost:3306/hive");
hmsHandler.create_dataconnector(connector);
CreateDataConnectorRequest connectorReq = new CreateDataConnectorRequest(connector);
hmsHandler.create_dataconnector_req(connectorReq);
} catch (Exception e) {
String err = e.getMessage();
String expected = "Operation type " + HiveOperationType.CREATEDATACONNECTOR+ " not allowed for user:" + unAuthorizedUser;
Expand All @@ -385,7 +389,8 @@ public void testS_CreateDataConnector_authorizedUser() {
UserGroupInformation.setLoginUser(UserGroupInformation.createRemoteUser(authorizedUser));
try {
DataConnector connector = new DataConnector(dcName, "mysql", "jdbc:mysql://localhost:3306/hive");
hmsHandler.create_dataconnector(connector);
CreateDataConnectorRequest connectorReq = new CreateDataConnectorRequest(connector);
hmsHandler.create_dataconnector_req(connectorReq);
} catch (Exception e) {
fail("testS_CreateDataConnector_authorizedUser() failed with " + e);
}
Expand All @@ -396,10 +401,12 @@ public void testT_AlterDataConnector_AuthorizedUser() {
UserGroupInformation.setLoginUser(UserGroupInformation.createRemoteUser(authorizedUser));
try {
DataConnector connector = new DataConnector(dcName, "mysql", "jdbc:mysql://localhost:3306/hive");
hmsHandler.create_dataconnector(connector);
CreateDataConnectorRequest connectorReq = new CreateDataConnectorRequest(connector);
hmsHandler.create_dataconnector_req(connectorReq);

DataConnector newConnector = new DataConnector(dcName, "mysql", "jdbc:mysql://localhost:3308/hive");
hmsHandler.alter_dataconnector(dcName, newConnector);
AlterDataConnectorRequest alterReq = new AlterDataConnectorRequest(dcName, newConnector);
hmsHandler.alter_dataconnector_req(alterReq);
} catch (Exception e) {
fail("testT_AlterDataConnector_AuthorizedUser() failed with " + e);
}
Expand All @@ -409,7 +416,10 @@ public void testT_AlterDataConnector_AuthorizedUser() {
public void testU_DropDataConnector_authorizedUser() {
UserGroupInformation.setLoginUser(UserGroupInformation.createRemoteUser(authorizedUser));
try {
hmsHandler.drop_dataconnector(dcName, true, true);
DropDataConnectorRequest dropDcReq = new DropDataConnectorRequest(dcName);
dropDcReq.setIfNotExists(true);
dropDcReq.setCheckReferences(true);
hmsHandler.drop_dataconnector_req(dropDcReq);
} catch (Exception e) {
fail("testU_DropDataConnector_authorizedUser() failed with " + e);
}
Expand Down
Loading

0 comments on commit 41c11fb

Please sign in to comment.