linliu-code commented on code in PR #12866:
URL: https://github.com/apache/hudi/pull/12866#discussion_r2105905517


##########
hudi-io/src/main/java/org/apache/hudi/io/hfile/HFileMetaBlock.java:
##########
@@ -34,6 +36,44 @@ protected HFileMetaBlock(HFileContext context,
   public ByteBuffer readContent() {
     return ByteBuffer.wrap(
         getByteBuff(),
-        startOffsetInBuff + HFILEBLOCK_HEADER_SIZE, 
uncompressedSizeWithoutHeader);
+        readAttributesOpt.get().startOffsetInBuff + HFILEBLOCK_HEADER_SIZE,
+        readAttributesOpt.get().uncompressedSizeWithoutHeader);
+  }
+
+  // ================ Below are for Write ================
+
+  protected final List<KeyValueEntry> entries = new ArrayList<>();
+
+  public HFileMetaBlock(HFileContext context) {
+    super(context, HFileBlockType.META, -1L);
+  }
+
+  public byte[] getFirstKey() {
+    return entries.get(0).key;
+  }
+
+  public void add(byte[] key, byte[] value) {
+    KeyValueEntry kv = new KeyValueEntry(key, value);
+    add(kv, false);
+  }
+
+  protected void add(KeyValueEntry kv, boolean sorted) {
+    entries.add(kv);
+    if (sorted) {
+      entries.sort(KeyValueEntry::compareTo);
+    }
+  }

Review Comment:
   No, have removed add function at all.



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