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

amogh-jahagirdar pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/iceberg.git


The following commit(s) were added to refs/heads/main by this push:
     new 9303e4c897 Core: Add toString to root manifest file (#18612)
9303e4c897 is described below

commit 9303e4c89705f139290ae8c1266fb4485785e279
Author: Anoop Johnson <[email protected]>
AuthorDate: Thu Oct 22 11:08:22 2026 -0700

    Core: Add toString to root manifest file (#18612)
---
 .../java/org/apache/iceberg/RootManifestFile.java    | 13 +++++++++++++
 .../org/apache/iceberg/TestRootManifestFile.java     | 20 ++++++++++++++++++++
 2 files changed, 33 insertions(+)

diff --git a/core/src/main/java/org/apache/iceberg/RootManifestFile.java 
b/core/src/main/java/org/apache/iceberg/RootManifestFile.java
index 5c7bf8bbc9..691f174516 100644
--- a/core/src/main/java/org/apache/iceberg/RootManifestFile.java
+++ b/core/src/main/java/org/apache/iceberg/RootManifestFile.java
@@ -21,6 +21,7 @@ package org.apache.iceberg;
 import java.nio.ByteBuffer;
 import java.util.Arrays;
 import java.util.List;
+import org.apache.iceberg.relocated.com.google.common.base.MoreObjects;
 import org.apache.iceberg.relocated.com.google.common.base.Preconditions;
 import org.apache.iceberg.util.ByteBuffers;
 
@@ -145,4 +146,16 @@ class RootManifestFile implements ManifestFile {
     return new RootManifestFile(
         location, length, snapshotId, sequenceNumber, firstRowId, 
keyMetadataCopy);
   }
+
+  @Override
+  public String toString() {
+    return MoreObjects.toStringHelper(this)
+        .add("location", location)
+        .add("length", length)
+        .add("snapshot_id", snapshotId)
+        .add("sequence_number", sequenceNumber)
+        .add("first_row_id", firstRowId)
+        .add("key_metadata", keyMetadata == null ? "null" : "(redacted)")
+        .toString();
+  }
 }
diff --git a/core/src/test/java/org/apache/iceberg/TestRootManifestFile.java 
b/core/src/test/java/org/apache/iceberg/TestRootManifestFile.java
index b69e6a21db..36ee7a9347 100644
--- a/core/src/test/java/org/apache/iceberg/TestRootManifestFile.java
+++ b/core/src/test/java/org/apache/iceberg/TestRootManifestFile.java
@@ -74,6 +74,26 @@ class TestRootManifestFile {
         .isNotSameAs(original.keyMetadata().array());
   }
 
+  @Test
+  void toStringRedactsKeyMetadata() {
+    RootManifestFile root =
+        new RootManifestFile(
+            LOCATION,
+            LENGTH,
+            SNAPSHOT_ID,
+            SEQUENCE_NUMBER,
+            FIRST_ROW_ID,
+            ByteBuffer.wrap(new byte[] {9, 8, 7}));
+
+    assertThat(root.toString())
+        .contains("location=" + LOCATION)
+        .contains("length=" + LENGTH)
+        .contains("snapshot_id=" + SNAPSHOT_ID)
+        .contains("sequence_number=" + SEQUENCE_NUMBER)
+        .contains("first_row_id=" + FIRST_ROW_ID)
+        .contains("key_metadata=(redacted)");
+  }
+
   @Test
   void unsupportedAccessorsThrow() {
     RootManifestFile root =

Reply via email to