aturoczy commented on code in PR #4329:
URL: https://github.com/apache/hive/pull/4329#discussion_r1195412006


##########
standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/Warehouse.java:
##########
@@ -240,15 +240,15 @@ public Path determineDatabasePath(Catalog cat, Database 
db) throws MetaException
       if (db.getName().equalsIgnoreCase(DEFAULT_DATABASE_NAME)) {
         return getWhRootExternal();
       } else {
-        return new Path(getWhRootExternal(), dbDirFromDbName(db));
+        return new Path(getWhRootExternal(), dbDirFromDbName(db.getName()));
       }
     } else {
-      return new Path(getDnsPath(new Path(cat.getLocationUri())), 
dbDirFromDbName(db));
+      return new Path(getDnsPath(new Path(cat.getLocationUri())), 
dbDirFromDbName(db.getName()));
     }
   }
 
-  private String dbDirFromDbName(Database db) throws MetaException {
-    return db.getName().toLowerCase() + DATABASE_WAREHOUSE_SUFFIX;
+  private String dbDirFromDbName(final String dbName) {
+    return MetaStoreUtils.encodeTableName(dbName.toLowerCase()) + 
DATABASE_WAREHOUSE_SUFFIX;

Review Comment:
   I would suggest to use 
`org.apache.hadoop.hive.metastore.utils.StringUtils.normalizeIdentifier ` it 
not just do the lowerCase but also remove the whitespaces (if somebody is 
pervert to use it :) ) As I see mostly the project use this util method for 
this.  
   
   I know the previous implementation also not used that 



-- 
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]

Reply via email to