You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by GitBox <gi...@apache.org> on 2022/08/01 13:38:21 UTC

[GitHub] [iceberg] singhpk234 commented on a diff in pull request #5405: Hive: Hadoop Path fails on s3 endpoint

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


##########
hive-metastore/src/main/java/org/apache/iceberg/hive/HiveCatalog.java:
##########
@@ -482,18 +481,19 @@ 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 = getWarehouseLocation(tableIdentifier.namespace().levels()[0]);
+    return String.format("%s/%s", warehouseLocation, tableIdentifier.name());
   }
 
-  private String getWarehouseLocation() {
+  private String getWarehouseLocation(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;
+    if (warehouseLocation.endsWith("/")) {
+      warehouseLocation = warehouseLocation.substring(0, warehouseLocation.length() - 1);
+    }

Review Comment:
   [minor] can use [LocationUtil#stripTrailingSlash](https://github.com/apache/iceberg/blob/master/core/src/main/java/org/apache/iceberg/util/LocationUtil.java#L26) .



-- 
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: issues-unsubscribe@iceberg.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org