yihua commented on code in PR #11131:
URL: https://github.com/apache/hudi/pull/11131#discussion_r1593442058


##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/io/HoodieAppendHandle.java:
##########
@@ -674,14 +674,15 @@ private static HoodieLogBlock getBlock(HoodieWriteConfig 
writeConfig,
                                          List<HoodieRecord> records,
                                          boolean shouldWriteRecordPositions,
                                          Map<HeaderMetadataType, String> 
header,
-                                         String keyField) {
+                                         String keyField,
+                                         HoodieStorage storage) {
     switch (logDataBlockFormat) {
       case AVRO_DATA_BLOCK:
         return new HoodieAvroDataBlock(records, shouldWriteRecordPositions, 
header, keyField);
       case HFILE_DATA_BLOCK:
         return new HoodieHFileDataBlock(
             records, header, writeConfig.getHFileCompressionAlgorithm(), new 
StoragePath(writeConfig.getBasePath()),
-            
writeConfig.getBooleanOrDefault(HoodieReaderConfig.USE_NATIVE_HFILE_READER));
+            
writeConfig.getBooleanOrDefault(HoodieReaderConfig.USE_NATIVE_HFILE_READER), 
storage);

Review Comment:
   Is passing the storage instance required here?  We should strictly do 
refactoring with changing as little argument as possible.



##########
hudi-common/src/main/java/org/apache/hudi/common/config/PropertiesConfig.java:
##########
@@ -0,0 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.hudi.common.config;
+
+public interface PropertiesConfig {

Review Comment:
   Javadocs?



##########
hudi-common/src/main/java/org/apache/hudi/common/fs/FSUtils.java:
##########
@@ -212,21 +192,7 @@ public static List<String> 
getAllPartitionFoldersThreeLevelsDown(HoodieStorage s
    * Given a base partition and a partition path, return relative path of 
partition path to the base path.
    */
   public static String getRelativePartitionPath(Path basePath, Path 
fullPartitionPath) {
-    basePath = CachingPath.getPathWithoutSchemeAndAuthority(basePath);
-    fullPartitionPath = 
CachingPath.getPathWithoutSchemeAndAuthority(fullPartitionPath);
-
-    String fullPartitionPathStr = fullPartitionPath.toString();
-
-    if (!fullPartitionPathStr.startsWith(basePath.toString())) {
-      throw new IllegalArgumentException("Partition path \"" + 
fullPartitionPathStr
-          + "\" does not belong to base-path \"" + basePath + "\"");
-    }
-
-    int partitionStartIndex = fullPartitionPathStr.indexOf(basePath.getName(),
-        basePath.getParent() == null ? 0 : 
basePath.getParent().toString().length());
-    // Partition-Path could be empty for non-partitioned tables
-    return partitionStartIndex + basePath.getName().length() == 
fullPartitionPathStr.length() ? ""
-        : fullPartitionPathStr.substring(partitionStartIndex + 
basePath.getName().length() + 1);
+    return getRelativePartitionPath(new StoragePath(basePath.toUri()), new 
StoragePath(fullPartitionPath.toUri()));

Review Comment:
   Let's separate this into a different PR since it's not relevant to fixing 
the dependency tree?



##########
hudi-common/src/main/java/org/apache/hudi/common/table/HoodieTableMetaClient.java:
##########
@@ -390,7 +389,9 @@ public HoodieStorage getStorage() {
           consistencyGuardConfig)
           : new NoOpConsistencyGuard();
 
-      storage = getStorageWithWrapperFS(
+      storage = (HoodieStorage) 
ReflectionUtils.loadClass("org.apache.hudi.storage.hadoop.HoodieHadoopStorage",
+          new Class<?>[] {StoragePath.class, StorageConfiguration.class, 
boolean.class, long.class, int.class,
+              long.class, String.class, ConsistencyGuard.class},

Review Comment:
   Have a util method to load the `HoodieStorage` using reflection?



##########
hudi-common/src/main/java/org/apache/hudi/common/table/HoodieTableMetaClient.java:
##########
@@ -390,7 +389,9 @@ public HoodieStorage getStorage() {
           consistencyGuardConfig)
           : new NoOpConsistencyGuard();
 
-      storage = getStorageWithWrapperFS(
+      storage = (HoodieStorage) 
ReflectionUtils.loadClass("org.apache.hudi.storage.hadoop.HoodieHadoopStorage",

Review Comment:
   Define a static final String for 
`"org.apache.hudi.storage.hadoop.HoodieHadoopStorage"`?



##########
hudi-common/src/main/java/org/apache/hudi/common/fs/FSUtils.java:
##########
@@ -96,20 +90,6 @@ public class FSUtils {
 
   private static final StoragePathFilter ALLOW_ALL_FILTER = file -> true;
 
-  public static Configuration buildInlineConf(Configuration conf) {

Review Comment:
   If it helps, can you separate the changes of moving util methods to a 
different set of PRs so they are easier to review?



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

Reply via email to