You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by GitBox <gi...@apache.org> on 2022/04/08 22:14:22 UTC

[GitHub] [hudi] nsivabalan commented on a diff in pull request #5266: [HUDI-3834] Fixing performance hits in reading Column Stats Index

nsivabalan commented on code in PR #5266:
URL: https://github.com/apache/hudi/pull/5266#discussion_r846516629


##########
hudi-common/src/main/java/org/apache/hudi/common/table/HoodieTableMetaClient.java:
##########
@@ -159,18 +166,34 @@ public static HoodieTableMetaClient reload(HoodieTableMetaClient oldMetaClient)
    */
   private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException {
     in.defaultReadObject();
+    String basePathStr = in.readUTF();
+    String metaPathStr = in.readUTF();
+
     fs = null; // will be lazily initialized
+    basePath = new LazyCachingPath(basePathStr);
+    metaPath = new LazyCachingPath(metaPathStr);
   }
 
   private void writeObject(java.io.ObjectOutputStream out) throws IOException {
     out.defaultWriteObject();
+    out.writeBytes(basePath.toString());
+    out.writeBytes(metaPath.toString());
+  }
+
+  /**
+   * Returns base path of the table
+   */
+  public Path getBasePathV2() {
+    return basePath;
   }
 
   /**
    * @return Base path
+   * @deprecated please use {@link #getBasePathV2()}
    */
+  @Deprecated

Review Comment:
   I see we are using getBasePath() in our baseRelation classes. do we need to fix them to getBasePathV2() ? 



##########
hudi-common/src/main/java/org/apache/hudi/hadoop/LazyCachingPath.java:
##########
@@ -20,19 +20,46 @@
 
 import org.apache.hadoop.fs.Path;
 
+import javax.annotation.concurrent.ThreadSafe;
 import java.net.URI;
 
 /**
+ * This is an extension of the {@code Path} class allowing to avoid repetitive
+ * computations (like {@code getFileName}, {@code toString}) which are secured
+ * by its immutability
+ *
  * NOTE: This class is thread-safe
  */
-public class FileNameCachingPath extends Path {
+@ThreadSafe
+public class LazyCachingPath extends Path {
 
-  // NOTE: volatile keyword is redundant here and put mostly for reader notice, since all
+  // NOTE: `volatile` keyword is redundant here and put mostly for reader notice, since all
   //       reads/writes to references are always atomic (including 64-bit JVMs)
   //       https://docs.oracle.com/javase/specs/jls/se8/html/jls-17.html#jls-17.7
   private volatile String fileName;
+  private volatile String s;

Review Comment:
   minor. s -> path.



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

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