dengzhhu653 commented on code in PR #3599: URL: https://github.com/apache/hive/pull/3599#discussion_r1672277732
########## standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java: ########## @@ -1343,7 +1381,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()); + db.setManagedLocationUri(req.getManagedLocationUri()); Review Comment: `db.setLocationUri(req.getLocationUri()); db.setManagedLocationUri(req.getManagedLocationUri());` but this two will restore back to the original from transformed location, am I right? ########## standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java: ########## @@ -1343,7 +1381,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()); + db.setManagedLocationUri(req.getManagedLocationUri()); Review Comment: `db.setLocationUri(req.getLocationUri()); db.setManagedLocationUri(req.getManagedLocationUri());` but this two will restore back to the original from transformed locations, am I right? -- 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