You are viewing a plain text version of this content. The canonical link for it is here.
Posted to gitbox@hive.apache.org by "schiller-oliver (via GitHub)" <gi...@apache.org> on 2023/05/16 16:31:28 UTC

[GitHub] [hive] schiller-oliver commented on a diff in pull request #4329: HIVE-27348: Encode database name when generating database path

schiller-oliver commented on code in PR #4329:
URL: https://github.com/apache/hive/pull/4329#discussion_r1195422277


##########
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:
   Yes, that sounds like a reasonable suggestion to me, although I hope that nobody is pervert enough use a db name with trailing spaces ;)



-- 
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-unsubscribe@hive.apache.org

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


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