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

huaxingao 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 1a20b546c7 Core: Add properties to InMemoryFileIO (#15469)
1a20b546c7 is described below

commit 1a20b546c7bd266ea381e7600689bcead61a8d30
Author: Eduard Tudenhoefner <[email protected]>
AuthorDate: Fri Feb 27 19:31:00 2026 +0100

    Core: Add properties to InMemoryFileIO (#15469)
---
 .../java/org/apache/iceberg/inmemory/InMemoryCatalog.java   |  2 +-
 .../java/org/apache/iceberg/inmemory/InMemoryFileIO.java    | 13 +++++++++++++
 .../org/apache/iceberg/inmemory/TestInMemoryFileIO.java     | 10 ++++++++++
 3 files changed, 24 insertions(+), 1 deletion(-)

diff --git 
a/core/src/main/java/org/apache/iceberg/inmemory/InMemoryCatalog.java 
b/core/src/main/java/org/apache/iceberg/inmemory/InMemoryCatalog.java
index 985127d651..975b5a39df 100644
--- a/core/src/main/java/org/apache/iceberg/inmemory/InMemoryCatalog.java
+++ b/core/src/main/java/org/apache/iceberg/inmemory/InMemoryCatalog.java
@@ -91,7 +91,7 @@ public class InMemoryCatalog extends BaseMetastoreViewCatalog
 
     String warehouse = 
properties.getOrDefault(CatalogProperties.WAREHOUSE_LOCATION, "");
     this.warehouseLocation = warehouse.replaceAll("/*$", "");
-    this.io = new InMemoryFileIO();
+    this.io = CatalogUtil.loadFileIO(InMemoryFileIO.class.getName(), 
properties, null);
     this.closeableGroup = new CloseableGroup();
     closeableGroup.addCloseable(metricsReporter());
     closeableGroup.setSuppressCloseFailure(true);
diff --git a/core/src/main/java/org/apache/iceberg/inmemory/InMemoryFileIO.java 
b/core/src/main/java/org/apache/iceberg/inmemory/InMemoryFileIO.java
index 19208a1e0c..5a999438c0 100644
--- a/core/src/main/java/org/apache/iceberg/inmemory/InMemoryFileIO.java
+++ b/core/src/main/java/org/apache/iceberg/inmemory/InMemoryFileIO.java
@@ -24,12 +24,25 @@ import org.apache.iceberg.io.FileIO;
 import org.apache.iceberg.io.InputFile;
 import org.apache.iceberg.io.OutputFile;
 import org.apache.iceberg.relocated.com.google.common.base.Preconditions;
+import org.apache.iceberg.relocated.com.google.common.collect.ImmutableMap;
 import org.apache.iceberg.relocated.com.google.common.collect.Maps;
+import org.apache.iceberg.util.SerializableMap;
 
 public class InMemoryFileIO implements FileIO {
 
   private static final Map<String, byte[]> IN_MEMORY_FILES = 
Maps.newConcurrentMap();
   private boolean closed = false;
+  private SerializableMap<String, String> properties = 
SerializableMap.copyOf(ImmutableMap.of());
+
+  @Override
+  public void initialize(Map<String, String> props) {
+    this.properties = SerializableMap.copyOf(props);
+  }
+
+  @Override
+  public Map<String, String> properties() {
+    return properties.immutableMap();
+  }
 
   public void addFile(String location, byte[] contents) {
     Preconditions.checkState(!closed, "Cannot call addFile after calling 
close()");
diff --git 
a/core/src/test/java/org/apache/iceberg/inmemory/TestInMemoryFileIO.java 
b/core/src/test/java/org/apache/iceberg/inmemory/TestInMemoryFileIO.java
index 262d34536e..97e5d29f4e 100644
--- a/core/src/test/java/org/apache/iceberg/inmemory/TestInMemoryFileIO.java
+++ b/core/src/test/java/org/apache/iceberg/inmemory/TestInMemoryFileIO.java
@@ -24,9 +24,11 @@ import static 
org.assertj.core.api.Assertions.assertThatExceptionOfType;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
+import java.util.Map;
 import java.util.UUID;
 import org.apache.iceberg.exceptions.AlreadyExistsException;
 import org.apache.iceberg.exceptions.NotFoundException;
+import org.apache.iceberg.relocated.com.google.common.collect.ImmutableMap;
 import org.junit.jupiter.api.Test;
 
 public class TestInMemoryFileIO {
@@ -129,6 +131,14 @@ public class TestInMemoryFileIO {
         .as("Files should be shared across all InMemoryFileIO instances");
   }
 
+  @Test
+  public void properties() {
+    InMemoryFileIO io = new InMemoryFileIO();
+    Map<String, String> properties = ImmutableMap.of("key1", "value1", "key2", 
"value2");
+    io.initialize(properties);
+    assertThat(io.properties()).isEqualTo(properties);
+  }
+
   private String randomLocation() {
     return "s3://foo/" + UUID.randomUUID();
   }

Reply via email to