dengzhhu653 commented on code in PR #3599:
URL: https://github.com/apache/hive/pull/3599#discussion_r1439240262


##########
standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java:
##########
@@ -1345,7 +1383,48 @@ public void createDatabase(Database db)
     if (!db.isSetCatalogName()) {
       db.setCatalogName(getDefaultCatalog(conf));
     }
-    client.create_database(db);
+    if (db.getName() == null) {
+      throw new MetaException("DbName cannot be null");
+    }
+    CreateDatabaseRequest req = new CreateDatabaseRequest(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()) {
+      req.setOwnerType(db.getOwnerType());
+    }
+    req.setCatalogName(db.getCatalogName());
+    if (db.isSetCreateTime()) {
+      req.setCreateTime(db.getCreateTime());
+    }
+    if (db.isSetManagedLocationUri()) {
+      req.setManagedLocationUri(db.getManagedLocationUri());
+    }
+    if (db.isSetType()) {
+      req.setType(db.getType());
+    }
+    if (db.isSetConnector_name()) {
+      req.setDataConnectorName(db.getConnector_name());
+    }
+    if (db.isSetRemote_dbname()) {
+      req.setRemote_dbname(db.getRemote_dbname());
+    }
+    client.create_database_req(req);
+    //location and manged location might be set/changed.
+    db.setLocationUri(req.getLocationUri());

Review Comment:
   why do we need to restore the location from req, is it for testing?



-- 
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: gitbox-unsubscr...@hive.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org
For additional commands, e-mail: gitbox-h...@hive.apache.org

Reply via email to