dengzhhu653 commented on code in PR #3599:
URL: https://github.com/apache/hive/pull/3599#discussion_r1024824772
##########
standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java:
##########
@@ -1274,7 +1308,46 @@ public void createDatabase(Database db)
if (!db.isSetCatalogName()) {
db.setCatalogName(getDefaultCatalog(conf));
}
- client.create_database(db);
+ CreateDatabaseRequest req = new CreateDatabaseRequest();
+ req.setDatabaseName(db.getName());
+ if (db.isSetDescription()) {
+ req.setDescription(db.getDescription());
+ }
+ if (db.isSetLocationUri()) {
+ req.setLocationUri(db.getLocationUri());
+ }
+ if (db.isSetParameters()) {
+ req.setParameters(db.getParameters());
+ }
+ if (db.isSetPrivileges()) {
+ req.setPrivileges(db.getPrivileges());
+ }
+ if (db.isSetOwnerName()) {
+ req.setOwnerName(db.getOwnerName());
+ }
+ if (db.isSetOwnerType()) {
Review Comment:
we can set property directly without null check, perhaps a database builder
is helpful, for example:
`
new CreateDatabaseRequest.Builder(catName/**required args*/,
dbName/**required
args*/).createTime(time).location(uri).managedLocation(location).build()
`
This works for other request as well, such as `AppendPartitionsRequest`,
`AddPartitionsRequest`, etc.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]