This is an automated email from the ASF dual-hosted git repository.

vhs pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hudi.git


The following commit(s) were added to refs/heads/master by this push:
     new b3355408ee22 refactor: Add Lombok annotations to hudi-io module 
(#17685)
b3355408ee22 is described below

commit b3355408ee22030ef17a5800b19e8ad4edca4b3c
Author: voonhous <[email protected]>
AuthorDate: Fri Dec 26 12:20:03 2025 +0800

    refactor: Add Lombok annotations to hudi-io module (#17685)
    
    * refactor: Add Lombok annotations to hudi-io module
    
    * Address comments
    
    * Fix rebasing errors
---
 hudi-io/pom.xml                                    |  6 +++
 .../org/apache/hudi/common/util/HoodieTimer.java   | 12 ++---
 .../apache/hudi/common/util/ReflectionUtils.java   | 14 +++---
 .../apache/hudi/io/compress/CompressionCodec.java  | 19 +++-----
 .../hudi/io/compress/HoodieCompressorFactory.java  |  6 ++-
 .../org/apache/hudi/io/hfile/BlockIndexEntry.java  | 50 +++++----------------
 .../hudi/io/hfile/CachingHFileReaderImpl.java      | 10 ++---
 .../org/apache/hudi/io/hfile/ChecksumType.java     | 14 +++---
 .../java/org/apache/hudi/io/hfile/HFileBlock.java  | 29 +++---------
 .../org/apache/hudi/io/hfile/HFileBlockType.java   |  7 ++-
 .../org/apache/hudi/io/hfile/HFileContext.java     | 25 +++--------
 .../java/org/apache/hudi/io/hfile/HFileCursor.java | 14 +++---
 .../java/org/apache/hudi/io/hfile/HFileInfo.java   | 14 +++---
 .../org/apache/hudi/io/hfile/HFileReaderImpl.java  |  7 ++-
 .../org/apache/hudi/io/hfile/HFileTrailer.java     | 52 +++++-----------------
 .../main/java/org/apache/hudi/io/hfile/Key.java    | 33 ++++----------
 .../java/org/apache/hudi/io/hfile/KeyValue.java    | 17 +++----
 .../org/apache/hudi/storage/StorageSchemes.java    | 14 +++---
 .../org/apache/hudi/io/hfile/TestHFileReader.java  | 35 +++------------
 .../org/apache/hudi/io/hfile/TestHFileWriter.java  |  9 ++--
 .../hudi/io/storage/TestStoragePathInfo.java       |  6 +--
 21 files changed, 119 insertions(+), 274 deletions(-)

diff --git a/hudi-io/pom.xml b/hudi-io/pom.xml
index dccc1d7e4484..1390affd37b6 100644
--- a/hudi-io/pom.xml
+++ b/hudi-io/pom.xml
@@ -167,6 +167,12 @@
       <artifactId>log4j-1.2-api</artifactId>
     </dependency>
 
+    <!-- Lombok -->
+    <dependency>
+      <groupId>org.projectlombok</groupId>
+      <artifactId>lombok</artifactId>
+    </dependency>
+
     <dependency>
       <groupId>org.apache.logging.log4j</groupId>
       <artifactId>log4j-slf4j-impl</artifactId>
diff --git a/hudi-io/src/main/java/org/apache/hudi/common/util/HoodieTimer.java 
b/hudi-io/src/main/java/org/apache/hudi/common/util/HoodieTimer.java
index 42ad16065f42..0da310c651ed 100644
--- a/hudi-io/src/main/java/org/apache/hudi/common/util/HoodieTimer.java
+++ b/hudi-io/src/main/java/org/apache/hudi/common/util/HoodieTimer.java
@@ -20,6 +20,8 @@ package org.apache.hudi.common.util;
 
 import org.apache.hudi.exception.HoodieException;
 
+import lombok.Getter;
+
 import java.util.ArrayDeque;
 import java.util.Deque;
 
@@ -46,7 +48,9 @@ public class HoodieTimer {
     }
   }
 
+  @Getter
   static class TimeInfo {
+
     // captures the startTime of the code block
     long startTime;
     // is the timing still running for the last started timer
@@ -57,14 +61,6 @@ public class HoodieTimer {
       this.isRunning = true;
     }
 
-    public long getStartTime() {
-      return startTime;
-    }
-
-    public boolean isRunning() {
-      return isRunning;
-    }
-
     public long stop() {
       this.isRunning = false;
       return System.currentTimeMillis() - startTime;
diff --git 
a/hudi-io/src/main/java/org/apache/hudi/common/util/ReflectionUtils.java 
b/hudi-io/src/main/java/org/apache/hudi/common/util/ReflectionUtils.java
index a184fb6da389..49c3e6c9dea3 100644
--- a/hudi-io/src/main/java/org/apache/hudi/common/util/ReflectionUtils.java
+++ b/hudi-io/src/main/java/org/apache/hudi/common/util/ReflectionUtils.java
@@ -20,8 +20,7 @@ package org.apache.hudi.common.util;
 
 import org.apache.hudi.exception.HoodieException;
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import lombok.extern.slf4j.Slf4j;
 
 import java.io.File;
 import java.io.IOException;
@@ -41,10 +40,9 @@ import java.util.stream.Stream;
 /**
  * A utility class for reflection.
  */
+@Slf4j
 public class ReflectionUtils {
 
-  private static final Logger LOG = 
LoggerFactory.getLogger(ReflectionUtils.class);
-
   private static final Map<String, Class<?>> CLAZZ_CACHE = new 
ConcurrentHashMap<>();
 
   public static Class<?> getClass(String clazzName) {
@@ -107,9 +105,9 @@ public class ReflectionUtils {
     } catch (NoSuchMethodException e) {
       String message = "Unable to instantiate class " + clazz;
       if (silenceWarning) {
-        LOG.debug(message, e);
+        log.debug(message, e);
       } else {
-        LOG.warn(message, e);
+        log.warn(message, e);
       }
       return false;
     }
@@ -138,7 +136,7 @@ public class ReflectionUtils {
     try {
       resources = classLoader.getResources(path);
     } catch (IOException e) {
-      LOG.error("Unable to fetch Resources in package " + e.getMessage());
+      log.error("Unable to fetch Resources in package " + e.getMessage());
     }
     List<File> directories = new ArrayList<>();
     while (Objects.requireNonNull(resources).hasMoreElements()) {
@@ -146,7 +144,7 @@ public class ReflectionUtils {
       try {
         directories.add(new File(resource.toURI()));
       } catch (URISyntaxException e) {
-        LOG.error("Unable to get " + e.getMessage());
+        log.error("Unable to get " + e.getMessage());
       }
     }
     List<String> classes = new ArrayList<>();
diff --git 
a/hudi-io/src/main/java/org/apache/hudi/io/compress/CompressionCodec.java 
b/hudi-io/src/main/java/org/apache/hudi/io/compress/CompressionCodec.java
index 6ddf004b94fa..90935f52da73 100644
--- a/hudi-io/src/main/java/org/apache/hudi/io/compress/CompressionCodec.java
+++ b/hudi-io/src/main/java/org/apache/hudi/io/compress/CompressionCodec.java
@@ -21,6 +21,10 @@ package org.apache.hudi.io.compress;
 
 import org.apache.hudi.common.util.ValidationUtils;
 
+import lombok.AccessLevel;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.Map;
@@ -31,6 +35,8 @@ import java.util.stream.Collectors;
  * Available compression codecs.
  * There should not be any assumption on the ordering or ordinal of the 
defined enums.
  */
+@AllArgsConstructor(access = AccessLevel.PACKAGE)
+@Getter
 public enum CompressionCodec {
   NONE("none", 2),
   BZIP2("bz2", 5),
@@ -51,19 +57,6 @@ public enum CompressionCodec {
   // even the ones that are not compressed! (They use the NONE algorithm)
   private final int id;
 
-  CompressionCodec(final String name, int id) {
-    this.name = name;
-    this.id = id;
-  }
-
-  public String getName() {
-    return name;
-  }
-
-  public int getId() {
-    return id;
-  }
-
   public static CompressionCodec findCodecByName(String name) {
     CompressionCodec codec =
         NAME_TO_COMPRESSION_CODEC_MAP.get(name.toLowerCase());
diff --git 
a/hudi-io/src/main/java/org/apache/hudi/io/compress/HoodieCompressorFactory.java
 
b/hudi-io/src/main/java/org/apache/hudi/io/compress/HoodieCompressorFactory.java
index 9d56e69d705c..03d933ac4382 100644
--- 
a/hudi-io/src/main/java/org/apache/hudi/io/compress/HoodieCompressorFactory.java
+++ 
b/hudi-io/src/main/java/org/apache/hudi/io/compress/HoodieCompressorFactory.java
@@ -22,12 +22,14 @@ package org.apache.hudi.io.compress;
 import org.apache.hudi.io.compress.airlift.HoodieAirliftGzipCompressor;
 import org.apache.hudi.io.compress.builtin.HoodieNoneCompressor;
 
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
+
 /**
  * Factory for {@link HoodieCompressor}.
  */
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
 public class HoodieCompressorFactory {
-  private HoodieCompressorFactory() {
-  }
 
   public static HoodieCompressor getCompressor(CompressionCodec 
compressionCodec) {
     switch (compressionCodec) {
diff --git 
a/hudi-io/src/main/java/org/apache/hudi/io/hfile/BlockIndexEntry.java 
b/hudi-io/src/main/java/org/apache/hudi/io/hfile/BlockIndexEntry.java
index 7c73b0222ff5..fd06719da32b 100644
--- a/hudi-io/src/main/java/org/apache/hudi/io/hfile/BlockIndexEntry.java
+++ b/hudi-io/src/main/java/org/apache/hudi/io/hfile/BlockIndexEntry.java
@@ -21,6 +21,9 @@ package org.apache.hudi.io.hfile;
 
 import org.apache.hudi.common.util.Option;
 
+import lombok.ToString;
+import lombok.Value;
+
 /**
  * Represents the index entry of a data block in the Data Index stored in the
  * {@link HFileBlockType#ROOT_INDEX} block.
@@ -30,55 +33,22 @@ import org.apache.hudi.common.util.Option;
  * When comparing two {@link BlockIndexEntry} instances, the underlying bytes 
of the keys
  * are compared in lexicographical order.
  */
+@Value
 public class BlockIndexEntry implements Comparable<BlockIndexEntry> {
+
   // The first key stored in the block index can be shortened to save memory,
   // i.e., a fake first key is stored in the block index entry, and such a fake
   // first key does not exist in the data block. The fake first key is
   // lexicographically greater than the last key of the previous block and
   // lexicographically equal or smaller than the actual first key of the 
current block.
-  private final Key firstKey;
-  private final Option<Key> nextBlockFirstKey;
-  private final long offset;
-  private final int size;
-
-  public BlockIndexEntry(Key firstKey, Option<Key> nextBlockFirstKey,
-                         long offset,
-                         int size) {
-    this.firstKey = firstKey;
-    this.nextBlockFirstKey = nextBlockFirstKey;
-    this.offset = offset;
-    this.size = size;
-  }
-
-  public Key getFirstKey() {
-    return firstKey;
-  }
-
-  public Option<Key> getNextBlockFirstKey() {
-    return nextBlockFirstKey;
-  }
-
-  public long getOffset() {
-    return offset;
-  }
-
-  public int getSize() {
-    return size;
-  }
+  Key firstKey;
+  @ToString.Exclude
+  Option<Key> nextBlockFirstKey;
+  long offset;
+  int size;
 
   @Override
   public int compareTo(BlockIndexEntry o) {
     return firstKey.compareTo(o.getFirstKey());
   }
-
-  @Override
-  public String toString() {
-    return "BlockIndexEntry{firstKey="
-        + firstKey.toString()
-        + ", offset="
-        + offset
-        + ", size="
-        + size
-        + "}";
-  }
 }
diff --git 
a/hudi-io/src/main/java/org/apache/hudi/io/hfile/CachingHFileReaderImpl.java 
b/hudi-io/src/main/java/org/apache/hudi/io/hfile/CachingHFileReaderImpl.java
index 3c4d4b055f8e..8adfdb2e564b 100644
--- a/hudi-io/src/main/java/org/apache/hudi/io/hfile/CachingHFileReaderImpl.java
+++ b/hudi-io/src/main/java/org/apache/hudi/io/hfile/CachingHFileReaderImpl.java
@@ -21,8 +21,7 @@ package org.apache.hudi.io.hfile;
 
 import org.apache.hudi.io.SeekableDataInputStream;
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import lombok.extern.slf4j.Slf4j;
 
 import java.io.IOException;
 import java.util.concurrent.TimeUnit;
@@ -32,10 +31,9 @@ import java.util.concurrent.TimeUnit;
  * <p>
  * Uses a shared static cache across all instances to maximize cache hits when 
multiple readers access the same file.
  */
+@Slf4j
 public class CachingHFileReaderImpl extends HFileReaderImpl {
 
-  private static final Logger LOG = 
LoggerFactory.getLogger(CachingHFileReaderImpl.class);
-
   private static volatile HFileBlockCache GLOBAL_BLOCK_CACHE;
   // Store first config values to check against cache config
   private static volatile Integer INITIAL_CACHE_SIZE;
@@ -59,7 +57,7 @@ public class CachingHFileReaderImpl extends HFileReaderImpl {
     if (GLOBAL_BLOCK_CACHE == null) {
       synchronized (CACHE_LOCK) {
         if (GLOBAL_BLOCK_CACHE == null) {
-          LOG.info("Initializing global HFileBlockCache with size: {}, TTL: {} 
minutes.",
+          log.info("Initializing global HFileBlockCache with size: {}, TTL: {} 
minutes.",
               cacheSize, cacheTtlMinutes);
           // Store the config used for initialization
           INITIAL_CACHE_SIZE = cacheSize;
@@ -70,7 +68,7 @@ public class CachingHFileReaderImpl extends HFileReaderImpl {
               TimeUnit.MINUTES);
         } else if (!INITIAL_CACHE_SIZE.equals(cacheSize) || 
!INITIAL_CACHE_TTL.equals(cacheTtlMinutes)) {
           // Log a warning if a different config is provided after 
initialization
-          LOG.warn("HFile block cache is already initialized. The provided 
configuration is being ignored. "
+          log.warn("HFile block cache is already initialized. The provided 
configuration is being ignored. "
                   + "Existing config: [Size: {}, TTL: {} mins], Ignored 
config: [Size: {}, TTL: {} mins].",
               INITIAL_CACHE_SIZE, INITIAL_CACHE_TTL,
               cacheSize, cacheTtlMinutes);
diff --git a/hudi-io/src/main/java/org/apache/hudi/io/hfile/ChecksumType.java 
b/hudi-io/src/main/java/org/apache/hudi/io/hfile/ChecksumType.java
index 1642370f161f..50d7f2e6b9bf 100644
--- a/hudi-io/src/main/java/org/apache/hudi/io/hfile/ChecksumType.java
+++ b/hudi-io/src/main/java/org/apache/hudi/io/hfile/ChecksumType.java
@@ -19,10 +19,16 @@
 
 package org.apache.hudi.io.hfile;
 
+import lombok.AccessLevel;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
 /**
  * Type of checksum used to validate the integrity of data block.
  * It determines the number of bytes used for checksum.
  */
+@AllArgsConstructor(access = AccessLevel.PRIVATE)
+@Getter
 public enum ChecksumType {
 
   NULL((byte) 0) {
@@ -55,14 +61,6 @@ public enum ChecksumType {
   /** returns the name of this checksum type */
   public abstract String getName();
 
-  private ChecksumType(final byte c) {
-    this.code = c;
-  }
-
-  public byte getCode() {
-    return this.code;
-  }
-
   /**
    * Use designated byte value to indicate checksum type.
    * @return type associated with passed code
diff --git a/hudi-io/src/main/java/org/apache/hudi/io/hfile/HFileBlock.java 
b/hudi-io/src/main/java/org/apache/hudi/io/hfile/HFileBlock.java
index 4961e5006806..56f75466dc61 100644
--- a/hudi-io/src/main/java/org/apache/hudi/io/hfile/HFileBlock.java
+++ b/hudi-io/src/main/java/org/apache/hudi/io/hfile/HFileBlock.java
@@ -23,6 +23,9 @@ import org.apache.hudi.exception.HoodieException;
 import org.apache.hudi.io.compress.CompressionCodec;
 
 import com.google.protobuf.CodedOutputStream;
+import lombok.AccessLevel;
+import lombok.Getter;
+import lombok.Setter;
 
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
@@ -75,10 +78,12 @@ public abstract class HFileBlock {
   }
 
   protected final HFileContext context;
+  @Getter
   protected final byte[] byteBuff;
   protected final int startOffsetInBuff;
   protected final int sizeCheckSum;
   protected final int uncompressedEndOffset;
+  @Getter
   private final HFileBlockType blockType;
   protected final int onDiskSizeWithoutHeader;
   protected final int uncompressedSizeWithoutHeader;
@@ -88,6 +93,8 @@ public abstract class HFileBlock {
   protected int startOffsetInCompressedBuff;
 
   // Write properties
+  @Getter(AccessLevel.PROTECTED)
+  @Setter(AccessLevel.PROTECTED)
   private long startOffsetInBuffForWrite = -1;
   private long previousBlockOffsetForWrite = -1;
 
@@ -200,14 +207,6 @@ public abstract class HFileBlock {
     return (int) numChunks;
   }
 
-  public HFileBlockType getBlockType() {
-    return blockType;
-  }
-
-  public byte[] getByteBuff() {
-    return byteBuff;
-  }
-
   public int getOnDiskSizeWithHeader() {
     return onDiskSizeWithoutHeader + HFILEBLOCK_HEADER_SIZE;
   }
@@ -308,20 +307,6 @@ public abstract class HFileBlock {
     return ByteBuffer.wrap(result);
   }
 
-  /**
-   * Sets start offset of the block in the buffer.
-   */
-  protected void setStartOffsetInBuffForWrite(long startOffsetInBuffForWrite) {
-    this.startOffsetInBuffForWrite = startOffsetInBuffForWrite;
-  }
-
-  /**
-   * Gets start offset of the block in the buffer.
-   */
-  protected long getStartOffsetInBuffForWrite() {
-    return this.startOffsetInBuffForWrite;
-  }
-
   /**
    * Returns checksum bytes if checksum type is not NULL.
    * Note that current HFileReaderImpl does not support non-NULL checksum.
diff --git a/hudi-io/src/main/java/org/apache/hudi/io/hfile/HFileBlockType.java 
b/hudi-io/src/main/java/org/apache/hudi/io/hfile/HFileBlockType.java
index ee800a1152c5..e2f711c29e81 100644
--- a/hudi-io/src/main/java/org/apache/hudi/io/hfile/HFileBlockType.java
+++ b/hudi-io/src/main/java/org/apache/hudi/io/hfile/HFileBlockType.java
@@ -21,6 +21,8 @@ package org.apache.hudi.io.hfile;
 
 import org.apache.hudi.io.util.IOUtils;
 
+import lombok.Getter;
+
 import java.io.DataInputStream;
 import java.io.IOException;
 
@@ -111,6 +113,7 @@ public enum HFileBlockType {
     DATA, META, INDEX, BLOOM, ALL_CATEGORIES, UNKNOWN
   }
 
+  @Getter
   private final byte[] magic;
   private final BlockCategory metricCat;
 
@@ -168,8 +171,4 @@ public enum HFileBlockType {
           + new String(magic) + ", got " + new String(buf));
     }
   }
-
-  public byte[] getMagic() {
-    return magic;
-  }
 }
diff --git a/hudi-io/src/main/java/org/apache/hudi/io/hfile/HFileContext.java 
b/hudi-io/src/main/java/org/apache/hudi/io/hfile/HFileContext.java
index 8523e8cddc61..e328b5356da9 100644
--- a/hudi-io/src/main/java/org/apache/hudi/io/hfile/HFileContext.java
+++ b/hudi-io/src/main/java/org/apache/hudi/io/hfile/HFileContext.java
@@ -23,10 +23,15 @@ import org.apache.hudi.io.compress.CompressionCodec;
 import org.apache.hudi.io.compress.HoodieCompressor;
 import org.apache.hudi.io.compress.HoodieCompressorFactory;
 
+import lombok.AccessLevel;
+import lombok.Getter;
+
 /**
  * The context of HFile that contains information of the blocks.
  */
+@Getter(AccessLevel.PACKAGE)
 public class HFileContext {
+
   private final CompressionCodec compressionCodec;
   private final HoodieCompressor compressor;
   private final ChecksumType checksumType;
@@ -44,26 +49,6 @@ public class HFileContext {
     this.fileCreationTime = fileCreationTime;
   }
 
-  CompressionCodec getCompressionCodec() {
-    return compressionCodec;
-  }
-
-  HoodieCompressor getCompressor() {
-    return compressor;
-  }
-
-  int getBlockSize() {
-    return blockSize;
-  }
-
-  ChecksumType getChecksumType() {
-    return checksumType;
-  }
-
-  long getFileCreationTime() {
-    return fileCreationTime;
-  }
-
   public static Builder builder() {
     return new Builder();
   }
diff --git a/hudi-io/src/main/java/org/apache/hudi/io/hfile/HFileCursor.java 
b/hudi-io/src/main/java/org/apache/hudi/io/hfile/HFileCursor.java
index b5921b8a4198..3aeacdbed239 100644
--- a/hudi-io/src/main/java/org/apache/hudi/io/hfile/HFileCursor.java
+++ b/hudi-io/src/main/java/org/apache/hudi/io/hfile/HFileCursor.java
@@ -21,16 +21,22 @@ package org.apache.hudi.io.hfile;
 
 import org.apache.hudi.common.util.Option;
 
+import lombok.AccessLevel;
+import lombok.Getter;
+
 /**
  * Stores the current position and {@link KeyValue} at the position in the 
HFile.
  * The same instance is used as a position cursor during HFile reading.
  * The {@link KeyValue} can be lazily read and cached.
  */
+@Getter
 public class HFileCursor {
+
   private static final int INVALID_POSITION = -1;
 
   private int offset;
   private Option<KeyValue> keyValue;
+  @Getter(AccessLevel.NONE)
   private boolean eof;
 
   public HFileCursor() {
@@ -47,14 +53,6 @@ public class HFileCursor {
     return !(offset == INVALID_POSITION || eof);
   }
 
-  public int getOffset() {
-    return offset;
-  }
-
-  public Option<KeyValue> getKeyValue() {
-    return keyValue;
-  }
-
   public void set(int offset, KeyValue keyValue) {
     this.offset = offset;
     this.keyValue = Option.of(keyValue);
diff --git a/hudi-io/src/main/java/org/apache/hudi/io/hfile/HFileInfo.java 
b/hudi-io/src/main/java/org/apache/hudi/io/hfile/HFileInfo.java
index 824ec1328e6c..354b104d1eb6 100644
--- a/hudi-io/src/main/java/org/apache/hudi/io/hfile/HFileInfo.java
+++ b/hudi-io/src/main/java/org/apache/hudi/io/hfile/HFileInfo.java
@@ -22,12 +22,17 @@ package org.apache.hudi.io.hfile;
 import org.apache.hudi.common.util.Option;
 import org.apache.hudi.io.util.IOUtils;
 
+import lombok.AccessLevel;
+import lombok.Getter;
+
 import java.util.Map;
 
 /**
  * Represents the HFile info read from {@link HFileBlockType#FILE_INFO} block.
  */
+@Getter
 public class HFileInfo {
+
   private static final String RESERVED_PREFIX = "hfile.";
   static final UTF8StringKey LAST_KEY =
       new UTF8StringKey(RESERVED_PREFIX + "LASTKEY");
@@ -43,6 +48,7 @@ public class HFileInfo {
       new UTF8StringKey(RESERVED_PREFIX + "AVG_VALUE_LEN");
   static final int KEY_VALUE_VERSION_WITH_MVCC_TS = 1;
 
+  @Getter(AccessLevel.NONE)
   private final Map<UTF8StringKey, byte[]> infoMap;
   private final long fileCreationTime;
   private final Option<Key> lastKey;
@@ -58,14 +64,6 @@ public class HFileInfo {
     }
   }
 
-  public long getFileCreationTime() {
-    return fileCreationTime;
-  }
-
-  public Option<Key> getLastKey() {
-    return lastKey;
-  }
-
   public byte[] get(UTF8StringKey key) {
     return infoMap.get(key);
   }
diff --git 
a/hudi-io/src/main/java/org/apache/hudi/io/hfile/HFileReaderImpl.java 
b/hudi-io/src/main/java/org/apache/hudi/io/hfile/HFileReaderImpl.java
index 5e785bff51eb..3134647fa38b 100644
--- a/hudi-io/src/main/java/org/apache/hudi/io/hfile/HFileReaderImpl.java
+++ b/hudi-io/src/main/java/org/apache/hudi/io/hfile/HFileReaderImpl.java
@@ -23,6 +23,8 @@ import org.apache.hudi.common.util.Option;
 import org.apache.hudi.common.util.ValidationUtils;
 import org.apache.hudi.io.SeekableDataInputStream;
 
+import lombok.AccessLevel;
+import lombok.Getter;
 import org.apache.logging.log4j.util.Strings;
 
 import java.io.ByteArrayInputStream;
@@ -48,6 +50,7 @@ public class HFileReaderImpl implements HFileReader {
 
   protected final HFileCursor cursor;
   protected boolean isMetadataInitialized = false;
+  @Getter(AccessLevel.PACKAGE)
   protected HFileTrailer trailer;
   protected HFileContext context;
   protected TreeMap<Key, BlockIndexEntry> dataBlockIndexEntryMap;
@@ -265,10 +268,6 @@ public class HFileReaderImpl implements HFileReader {
     stream.close();
   }
 
-  HFileTrailer getTrailer() {
-    return trailer;
-  }
-
   Map<Key, BlockIndexEntry> getDataBlockIndexMap() {
     return dataBlockIndexEntryMap;
   }
diff --git a/hudi-io/src/main/java/org/apache/hudi/io/hfile/HFileTrailer.java 
b/hudi-io/src/main/java/org/apache/hudi/io/hfile/HFileTrailer.java
index 474ab71a2ae3..3f62fc94b883 100644
--- a/hudi-io/src/main/java/org/apache/hudi/io/hfile/HFileTrailer.java
+++ b/hudi-io/src/main/java/org/apache/hudi/io/hfile/HFileTrailer.java
@@ -22,9 +22,11 @@ package org.apache.hudi.io.hfile;
 import org.apache.hudi.io.compress.CompressionCodec;
 import org.apache.hudi.io.hfile.protobuf.generated.HFileProtos;
 
+import lombok.Getter;
+import lombok.ToString;
+
 import java.io.DataInputStream;
 import java.io.IOException;
-import java.util.Arrays;
 
 import static org.apache.hudi.io.hfile.DataSize.MAGIC_LENGTH;
 import static org.apache.hudi.io.hfile.DataSize.SIZEOF_INT32;
@@ -33,7 +35,9 @@ import static org.apache.hudi.io.hfile.DataSize.SIZEOF_INT32;
  * Represents a HFile trailer, which is serialized and deserialized using
  * {@link HFileProtos.TrailerProto} with Protobuf.
  */
+@ToString
 public class HFileTrailer {
+
   // This is the trailer size for HFile V3
   public static final int TRAILER_SIZE = 1024 * 4;
   private static final int NOT_PB_SIZE = MAGIC_LENGTH + SIZEOF_INT32;
@@ -43,15 +47,18 @@ public class HFileTrailer {
 
   // The offset to the section of the file that should be loaded at the time 
the file is
   // being opened: i.e. on open we load the root index, file info, etc.
+  @Getter
   private long loadOnOpenDataOffset;
 
   // The number of entries in the root data index
+  @Getter
   private int dataIndexCount;
 
   // Total uncompressed size of all blocks of the data index
   private long uncompressedDataIndexSize;
 
   // The number of entries in the meta index
+  @Getter
   private int metaIndexCount;
 
   // The total uncompressed size of keys/values stored in the file
@@ -61,9 +68,11 @@ public class HFileTrailer {
   private long keyValueEntryCount;
 
   // The compression codec used for all blocks.
+  @Getter
   private CompressionCodec compressionCodec = CompressionCodec.NONE;
 
   // The number of levels in the potentially multi-level data index.
+  @Getter
   private int numDataIndexLevels;
 
   // The offset of the first data block.
@@ -90,30 +99,10 @@ public class HFileTrailer {
     return TRAILER_SIZE;
   }
 
-  public long getLoadOnOpenDataOffset() {
-    return loadOnOpenDataOffset;
-  }
-
-  public int getNumDataIndexLevels() {
-    return numDataIndexLevels;
-  }
-
-  public int getDataIndexCount() {
-    return dataIndexCount;
-  }
-  
-  public int getMetaIndexCount() {
-    return metaIndexCount;
-  }
-
   public long getNumKeyValueEntries() {
     return keyValueEntryCount;
   }
 
-  public CompressionCodec getCompressionCodec() {
-    return compressionCodec;
-  }
-
   public void deserialize(DataInputStream stream) throws IOException {
     HFileBlockType.TRAILER.readAndCheckMagic(stream);
     // Read Protobuf
@@ -166,25 +155,4 @@ public class HFileTrailer {
       encryptionKey = trailerProto.getEncryptionKey().toByteArray();
     }
   }
-
-  @Override
-  public String toString() {
-    return "HFileTrailer{"
-        + "fileInfoOffset=" + fileInfoOffset
-        + ", loadOnOpenDataOffset=" + loadOnOpenDataOffset
-        + ", dataIndexCount=" + dataIndexCount
-        + ", uncompressedDataIndexSize=" + uncompressedDataIndexSize
-        + ", metaIndexCount=" + metaIndexCount
-        + ", totalUncompressedBytes=" + totalUncompressedBytes
-        + ", entryCount=" + keyValueEntryCount
-        + ", compressionCodec=" + compressionCodec
-        + ", numDataIndexLevels=" + numDataIndexLevels
-        + ", firstDataBlockOffset=" + firstDataBlockOffset
-        + ", lastDataBlockOffset=" + lastDataBlockOffset
-        + ", comparatorClassName='" + comparatorClassName + '\''
-        + ", encryptionKey=" + Arrays.toString(encryptionKey)
-        + ", majorVersion=" + majorVersion
-        + ", minorVersion=" + minorVersion
-        + '}';
-  }
 }
diff --git a/hudi-io/src/main/java/org/apache/hudi/io/hfile/Key.java 
b/hudi-io/src/main/java/org/apache/hudi/io/hfile/Key.java
index fdeba3d61546..f8e2c4b03a20 100644
--- a/hudi-io/src/main/java/org/apache/hudi/io/hfile/Key.java
+++ b/hudi-io/src/main/java/org/apache/hudi/io/hfile/Key.java
@@ -21,6 +21,10 @@ package org.apache.hudi.io.hfile;
 
 import org.apache.hudi.io.util.IOUtils;
 
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+import lombok.ToString;
+
 import static org.apache.hudi.common.util.StringUtils.fromUTF8Bytes;
 import static org.apache.hudi.io.hfile.DataSize.SIZEOF_INT16;
 import static org.apache.hudi.io.hfile.HFileUtils.compareKeys;
@@ -29,7 +33,11 @@ import static org.apache.hudi.io.util.IOUtils.readShort;
 /**
  * Represents the key part only.
  */
+@AllArgsConstructor
+@Getter
+@ToString
 public class Key implements Comparable<Key> {
+
   private static final int CONTENT_LENGTH_SIZE = SIZEOF_INT16;
   private final byte[] bytes;
   private final int offset;
@@ -39,24 +47,6 @@ public class Key implements Comparable<Key> {
     this(bytes, 0, bytes.length);
   }
 
-  public Key(byte[] bytes, int offset, int length) {
-    this.bytes = bytes;
-    this.offset = offset;
-    this.length = length;
-  }
-
-  public byte[] getBytes() {
-    return bytes;
-  }
-
-  public int getOffset() {
-    return this.offset;
-  }
-
-  public int getLength() {
-    return length;
-  }
-
   public int getContentOffset() {
     return getOffset() + CONTENT_LENGTH_SIZE;
   }
@@ -88,11 +78,4 @@ public class Key implements Comparable<Key> {
   public int compareTo(Key o) {
     return compareKeys(this, o);
   }
-
-  @Override
-  public String toString() {
-    return "Key{"
-        + new String(getBytes(), getContentOffset(), getContentLength())
-        + "}";
-  }
 }
diff --git a/hudi-io/src/main/java/org/apache/hudi/io/hfile/KeyValue.java 
b/hudi-io/src/main/java/org/apache/hudi/io/hfile/KeyValue.java
index 9ee6b5c36bf1..4da68a1b2a81 100644
--- a/hudi-io/src/main/java/org/apache/hudi/io/hfile/KeyValue.java
+++ b/hudi-io/src/main/java/org/apache/hudi/io/hfile/KeyValue.java
@@ -19,16 +19,22 @@
 
 package org.apache.hudi.io.hfile;
 
+import lombok.AccessLevel;
+import lombok.Getter;
+
 import static org.apache.hudi.io.hfile.DataSize.SIZEOF_INT32;
 import static org.apache.hudi.io.util.IOUtils.readInt;
 
 /**
  * Represents a key-value pair in the data block.
  */
+@Getter
 public class KeyValue {
+
   // Key part starts after the key length (integer) and value length (integer)
   public static final int KEY_OFFSET = SIZEOF_INT32 * 2;
   private final byte[] bytes;
+  @Getter(AccessLevel.NONE)
   private final int offset;
   private final Key key;
 
@@ -38,17 +44,6 @@ public class KeyValue {
     this.key = new Key(bytes, offset + KEY_OFFSET, readInt(bytes, offset));
   }
 
-  /**
-   * @return the backing array of the entire KeyValue (all KeyValue fields are 
in a single array)
-   */
-  public byte[] getBytes() {
-    return bytes;
-  }
-
-  public Key getKey() {
-    return key;
-  }
-
   /**
    * @return key content offset.
    */
diff --git a/hudi-io/src/main/java/org/apache/hudi/storage/StorageSchemes.java 
b/hudi-io/src/main/java/org/apache/hudi/storage/StorageSchemes.java
index 66c64ee979fa..77ecb536cf3e 100644
--- a/hudi-io/src/main/java/org/apache/hudi/storage/StorageSchemes.java
+++ b/hudi-io/src/main/java/org/apache/hudi/storage/StorageSchemes.java
@@ -22,9 +22,11 @@ package org.apache.hudi.storage;
 import org.apache.hudi.common.util.Option;
 import org.apache.hudi.common.util.StringUtils;
 
+import lombok.Getter;
+
 import java.util.Arrays;
-import java.util.Set;
 import java.util.HashSet;
+import java.util.Set;
 
 /**
  * All the supported storage schemes in Hoodie.
@@ -97,11 +99,13 @@ public enum StorageSchemes {
   // here is a trade-off between rpc times and throughput of storage meta 
service
   private static final Set<String> LIST_STATUS_FRIENDLY_SCHEMES = new 
HashSet<>(Arrays.asList(FILE.scheme, S3.scheme, S3A.scheme, GCS.scheme));
 
+  @Getter
   private final String scheme;
   // null for uncertain if write is transactional, please update this for each 
FS
   private final Boolean isWriteTransactional;
   // null for uncertain if dfs support atomic create&delete, please update 
this for each FS
   private final Boolean supportAtomicCreation;
+  @Getter
   private final String storageLockClass;
 
   StorageSchemes(
@@ -115,10 +119,6 @@ public enum StorageSchemes {
     this.storageLockClass = storageLockClass;
   }
 
-  public String getScheme() {
-    return scheme;
-  }
-
   public boolean isWriteTransactional() {
     return isWriteTransactional != null && isWriteTransactional;
   }
@@ -131,10 +131,6 @@ public enum StorageSchemes {
     return !StringUtils.isNullOrEmpty(storageLockClass);
   }
 
-  public String getStorageLockClass() {
-    return storageLockClass;
-  }
-
   public static boolean isSchemeSupported(String scheme) {
     return Arrays.stream(values()).anyMatch(s -> s.getScheme().equals(scheme));
   }
diff --git 
a/hudi-io/src/test/java/org/apache/hudi/io/hfile/TestHFileReader.java 
b/hudi-io/src/test/java/org/apache/hudi/io/hfile/TestHFileReader.java
index 83afeba6edf9..96c24a147ee6 100644
--- a/hudi-io/src/test/java/org/apache/hudi/io/hfile/TestHFileReader.java
+++ b/hudi-io/src/test/java/org/apache/hudi/io/hfile/TestHFileReader.java
@@ -20,9 +20,11 @@
 package org.apache.hudi.io.hfile;
 
 import org.apache.hudi.common.util.Option;
-import org.apache.hudi.io.ByteBufferBackedInputStream;
 import org.apache.hudi.io.ByteArraySeekableDataInputStream;
+import org.apache.hudi.io.ByteBufferBackedInputStream;
 
+import lombok.AllArgsConstructor;
+import lombok.Getter;
 import org.junit.jupiter.api.Test;
 import org.junit.jupiter.params.ParameterizedTest;
 import org.junit.jupiter.params.provider.Arguments;
@@ -37,13 +39,13 @@ import java.util.List;
 import java.util.function.Function;
 import java.util.stream.Stream;
 
-import static org.apache.hudi.io.util.FileIOUtils.readAsByteArray;
 import static 
org.apache.hudi.io.hfile.HFileReader.SEEK_TO_BEFORE_BLOCK_FIRST_KEY;
 import static 
org.apache.hudi.io.hfile.HFileReader.SEEK_TO_BEFORE_FILE_FIRST_KEY;
 import static org.apache.hudi.io.hfile.HFileReader.SEEK_TO_EOF;
 import static org.apache.hudi.io.hfile.HFileReader.SEEK_TO_FOUND;
 import static org.apache.hudi.io.hfile.HFileReader.SEEK_TO_IN_RANGE;
 import static org.apache.hudi.io.hfile.HFileUtils.getValue;
+import static org.apache.hudi.io.util.FileIOUtils.readAsByteArray;
 import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertFalse;
 import static org.junit.jupiter.api.Assertions.assertThrows;
@@ -985,36 +987,13 @@ public class TestHFileReader {
     }
   }
 
+  @AllArgsConstructor
+  @Getter
   static class KeyLookUpInfo {
+
     private final String lookUpKey;
     private final int expectedSeekToResult;
     private final String expectedKey;
     private final String expectedValue;
-
-    public KeyLookUpInfo(String lookUpKey,
-                         int expectedSeekToResult,
-                         String expectedKey,
-                         String expectedValue) {
-      this.lookUpKey = lookUpKey;
-      this.expectedSeekToResult = expectedSeekToResult;
-      this.expectedKey = expectedKey;
-      this.expectedValue = expectedValue;
-    }
-
-    public String getLookUpKey() {
-      return lookUpKey;
-    }
-
-    public int getExpectedSeekToResult() {
-      return expectedSeekToResult;
-    }
-
-    public String getExpectedKey() {
-      return expectedKey;
-    }
-
-    public String getExpectedValue() {
-      return expectedValue;
-    }
   }
 }
diff --git 
a/hudi-io/src/test/java/org/apache/hudi/io/hfile/TestHFileWriter.java 
b/hudi-io/src/test/java/org/apache/hudi/io/hfile/TestHFileWriter.java
index f6b015ba68a7..d7048738afb4 100644
--- a/hudi-io/src/test/java/org/apache/hudi/io/hfile/TestHFileWriter.java
+++ b/hudi-io/src/test/java/org/apache/hudi/io/hfile/TestHFileWriter.java
@@ -19,14 +19,13 @@
 
 package org.apache.hudi.io.hfile;
 
-import org.apache.hudi.io.ByteBufferBackedInputStream;
 import org.apache.hudi.io.ByteArraySeekableDataInputStream;
+import org.apache.hudi.io.ByteBufferBackedInputStream;
 import org.apache.hudi.io.SeekableDataInputStream;
 
+import lombok.extern.slf4j.Slf4j;
 import org.junit.jupiter.api.AfterEach;
 import org.junit.jupiter.api.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 import java.io.DataOutputStream;
 import java.io.IOException;
@@ -52,8 +51,8 @@ import static 
org.apache.hudi.io.hfile.HFileInfo.MAX_MVCC_TS_KEY;
 import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertTrue;
 
+@Slf4j
 class TestHFileWriter {
-  private static final Logger LOG = 
LoggerFactory.getLogger(TestHFileWriter.class);
   private static final String TEST_FILE = "test.hfile";
   private static final HFileContext CONTEXT = HFileContext.builder().build();
 
@@ -72,7 +71,7 @@ class TestHFileWriter {
     validateHFileStructure();
     // 4. Validate consistency with HFileReader.
     validateConsistencyWithHFileReader();
-    LOG.info("All validations passed!");
+    log.info("All validations passed!");
   }
 
   @Test
diff --git 
a/hudi-io/src/test/java/org/apache/hudi/io/storage/TestStoragePathInfo.java 
b/hudi-io/src/test/java/org/apache/hudi/io/storage/TestStoragePathInfo.java
index 95cf4d798a4b..422f8d823bfd 100644
--- a/hudi-io/src/test/java/org/apache/hudi/io/storage/TestStoragePathInfo.java
+++ b/hudi-io/src/test/java/org/apache/hudi/io/storage/TestStoragePathInfo.java
@@ -22,9 +22,8 @@ package org.apache.hudi.io.storage;
 import org.apache.hudi.storage.StoragePath;
 import org.apache.hudi.storage.StoragePathInfo;
 
+import lombok.extern.slf4j.Slf4j;
 import org.junit.jupiter.api.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
@@ -38,8 +37,9 @@ import static org.junit.jupiter.api.Assertions.assertFalse;
 /**
  * Tests {@link StoragePathInfo}
  */
+@Slf4j
 public class TestStoragePathInfo {
-  private static final Logger LOG = 
LoggerFactory.getLogger(TestStoragePathInfo.class);
+
   private static final long LENGTH = 100;
   private static final short BLOCK_REPLICATION = 1;
   private static final long BLOCK_SIZE = 1000000L;


Reply via email to