CTTY commented on code in PR #6882:
URL: https://github.com/apache/hudi/pull/6882#discussion_r1037481454


##########
hudi-common/src/main/java/org/apache/hudi/common/storage/HoodieObjectStoreStorageStrategy.java:
##########
@@ -0,0 +1,42 @@
+package org.apache.hudi.common.storage;
+
+import org.apache.hudi.common.config.HoodieConfig;
+import org.apache.hudi.common.fs.FSUtils;
+import org.apache.hudi.common.table.HoodieTableConfig;
+import org.apache.hudi.common.util.StringUtils;
+import org.apache.hudi.common.util.hash.HashID;
+import org.apache.log4j.LogManager;
+import org.apache.log4j.Logger;
+
+public class HoodieObjectStoreStorageStrategy implements HoodieStorageStrategy 
{
+
+  private static final Logger LOG = 
LogManager.getLogger(HoodieObjectStoreStorageStrategy.class);
+
+  private static final int HASH_SEED = 0x0e43cd7a;
+
+  private String tableName;
+  private String storagePath;
+
+  public HoodieObjectStoreStorageStrategy(HoodieConfig config) {
+    this.tableName = config.getString(HoodieTableConfig.HOODIE_TABLE_NAME_KEY);
+    this.storagePath = 
config.getString(HoodieTableConfig.HOODIE_STORAGE_PATH_KEY);
+  }
+
+  public String storageLocation(String partitionPath, String fileId) {
+    if (StringUtils.isNullOrEmpty(partitionPath) || 
NON_PARTITIONED_NAME.equals(partitionPath)) {
+      // non-partitioned table
+      return String.format("%s/%08x/%s", storagePath, hash(fileId), tableName);
+    } else {
+      String properPartitionPath = FSUtils.stripLeadingSlash(partitionPath);
+      return String.format("%s/%08x/%s/%s", storagePath, hash(fileId), 
tableName, properPartitionPath);

Review Comment:
   Yes, I'll update this



-- 
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: commits-unsubscr...@hudi.apache.org

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

Reply via email to