pvary commented on code in PR #5405:
URL: https://github.com/apache/iceberg/pull/5405#discussion_r934491312


##########
hive-metastore/src/main/java/org/apache/iceberg/hive/HiveCatalog.java:
##########
@@ -482,18 +481,16 @@ protected String defaultWarehouseLocation(TableIdentifier 
tableIdentifier) {
       throw new RuntimeException("Interrupted during commit", e);
     }
 
-    // Otherwise stick to the {WAREHOUSE_DIR}/{DB_NAME}.db/{TABLE_NAME} path
-    String warehouseLocation = getWarehouseLocation();
-    return String.format(
-        "%s/%s.db/%s",
-        warehouseLocation, tableIdentifier.namespace().levels()[0], 
tableIdentifier.name());
+    // Otherwise, stick to the {WAREHOUSE_DIR}/{DB_NAME}.db/{TABLE_NAME} path
+    String warehouseLocation = 
getDatabaseLocation(tableIdentifier.namespace().levels()[0]);
+    return String.format("%s/%s", warehouseLocation, tableIdentifier.name());
   }
 
-  private String getWarehouseLocation() {
+  private String getDatabaseLocation(String warehouseName) {
     String warehouseLocation = 
conf.get(HiveConf.ConfVars.METASTOREWAREHOUSE.varname);
     Preconditions.checkNotNull(
         warehouseLocation, "Warehouse location is not set: 
hive.metastore.warehouse.dir=null");
-    return warehouseLocation;
+    return String.format("%s/%s.db", warehouseLocation, warehouseName);

Review Comment:
   There might be some unexpected differences between the old path and the new 
path. One such thing I can think of  is if the configuration contains a `/` 
character at the end of the string. There might be some other differences also.
   
   We should make sure that we minimise/remove these differences.



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