nsivabalan commented on a change in pull request #3128:
URL: https://github.com/apache/hudi/pull/3128#discussion_r669909750



##########
File path: 
hudi-common/src/main/java/org/apache/hudi/common/util/collection/BitCaskDiskMap.java
##########
@@ -188,21 +204,25 @@ public R get(Object key) {
   }
 
   private R get(ValueMetadata entry) {
-    return get(entry, getRandomAccessFile());
+    return get(entry, getRandomAccessFile(), isCompressionEnabled);
   }
 
-  public static <R> R get(ValueMetadata entry, RandomAccessFile file) {
+  public static <R> R get(ValueMetadata entry, RandomAccessFile file, boolean 
isCompressionEnabled) {
     try {
-      return SerializationUtils
-          .deserialize(SpillableMapUtils.readBytesFromDisk(file, 
entry.getOffsetOfValue(), entry.getSizeOfValue()));
+      byte[] bytesFromDisk = SpillableMapUtils.readBytesFromDisk(file, 
entry.getOffsetOfValue(), entry.getSizeOfValue());
+      if (isCompressionEnabled) {
+        return 
SerializationUtils.deserialize(DISK_COMPRESSION_REF.get().decompressBytes(bytesFromDisk));
+      }

Review comment:
       not required to fix in this patch, but something to keep in mind. would 
be good to have an explicit else block for line 216. this "if" block is just 
one line and so its fine. But if its a large "if" block, then reader/dev might 
might wonder that some code path may not return from within "if" block and 
hence we have a return outside of "if" block. 
   So, whenever you have "if" "else"s, try to always explicitly add else block. 




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